CN117939153A - Video encoding method, video encoding device, electronic device, storage medium, and program product - Google Patents

Video encoding method, video encoding device, electronic device, storage medium, and program product Download PDF

Info

Publication number
CN117939153A
CN117939153A CN202410199540.0A CN202410199540A CN117939153A CN 117939153 A CN117939153 A CN 117939153A CN 202410199540 A CN202410199540 A CN 202410199540A CN 117939153 A CN117939153 A CN 117939153A
Authority
CN
China
Prior art keywords
coding
run
pixel block
pixel
palette
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410199540.0A
Other languages
Chinese (zh)
Inventor
冯伟伦
周超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202410199540.0A priority Critical patent/CN117939153A/en
Publication of CN117939153A publication Critical patent/CN117939153A/en
Pending legal-status Critical Current

Links

Abstract

The disclosure provides a video coding method, a video coding device, electronic equipment, a storage medium and a computer program product, and relates to the technical field of video processing. The method comprises the following steps: acquiring a video frame to be processed, and determining a pixel block to be encoded based on the video frame to be processed, wherein the pixel block to be encoded is a specified pixel block which is subjected to encoding search processing and palette search processing; determining palette information of a pixel block to be encoded, the palette information including a palette mapping matrix; scanning the palette mapping matrix, and determining an initial run code according to a scanning result; and executing merging coding operation on the initial run-length codes according to the pixel index values and the scanning modes of the initial run-length codes to obtain coded video code streams. The present disclosure performs a search process on a specified pixel block to be subjected to a palette search process, performs a merge encoding based on the search result, and reduces the time-consuming of palette search as much as possible with introducing as little additional distortion as possible.

Description

Video encoding method, video encoding device, electronic device, storage medium, and program product
Technical Field
The present disclosure relates to the field of video processing technology, and in particular, to a video encoding method, a video encoding apparatus, an electronic device, a computer readable storage medium, and a computer program product.
Background
Video consists of pixels, which can be represented as brightnesses, i.e., gray values (representing luminence or Luma, Y), chromaticities (Chrominance or Chroma, U and V) three components, each represented by 8-bit (bit) unsigned numbers, with a total of 256 a3 pixels. In natural video sequences, pixels in a coding block are often numerous and diverse, constituting fine and complex video details.
In screen content video (e.g., screen recording, sharing, etc.), the variety of pixels within a code block is often extremely limited, even though some code blocks have only two unique pixels, such as white text in a black background. If the traditional coding method is directly adopted, sharp texture of characters can cause coding to generate perceivable coding abnormality. Based on this, palette coding modes have been generated.
The palette mode is mainly composed of: (1) Referring to fig. 1, fig. 1 is a schematic diagram of palette information of a current coding unit. (2) Mapping matrix, index (Index) in palette corresponding to each position in current coding block. Referring to fig. 2, fig. 2 is a schematic diagram of a mapping matrix obtained by classifying palette information of a current coding unit. Through the steps, the Pixel information in the palette can be mapped into the corresponding position, and if the Pixel cannot be corresponding to the palette in the current coding block, the value of the Pixel is directly coded as an escape Pixel (escape Pixel).
Disclosure of Invention
The present disclosure provides a video encoding method, apparatus, electronic device, computer readable storage medium and computer program product, to at least solve the problem in the related art that the searching time is wasted greatly in the palette mode due to the complex searching operation of the palette mode. The technical scheme of the present disclosure is as follows:
according to a first aspect of an embodiment of the present disclosure, there is provided a video encoding method, including: acquiring a video frame to be processed, and determining a pixel block to be encoded based on the video frame to be processed, wherein the pixel block to be encoded is a specified pixel block which is subjected to encoding search processing and palette search processing; determining palette information of the pixel block to be encoded, the palette information including a palette mapping matrix; scanning the palette mapping matrix, and determining an initial run code according to a scanning result; and executing merging coding operation on the initial run code according to the pixel index value and the scanning mode of the initial run code to obtain a video code stream after coding processing.
In an exemplary embodiment of the present disclosure, the acquiring a video frame to be processed includes: acquiring an initial video frame; and performing coding search processing on the initial video frame by adopting a reconstruction coding search step after sequence adjustment to obtain the video frame to be processed, wherein the reconstruction coding search step comprises inter-frame merging operation, inter-frame coding operation, blocking processing operation, intra-frame searching operation and intra-frame block copying operation.
In an exemplary embodiment of the disclosure, the determining a block of pixels to be encoded based on the video frame to be processed includes: acquiring an initial pixel block based on the video frame to be processed, and determining a coding mode matched with the initial pixel block; if the initial pixel block does not comprise a sub-pixel block and does not need to be subjected to a block processing operation, determining the initial pixel block as the pixel block to be encoded; if the initial pixel block comprises the sub-pixel block and the coding mode of at least one sub-pixel block is a palette mode, determining the initial pixel block as the pixel block to be coded; if the coding mode is an inter-coding mode or a block processing mode, determining the initial pixel block as the pixel block to be coded; if the pixel block size of the initial pixel block is a specified pixel size and the encoding mode is an inter encoding mode, the initial pixel block is determined to be the pixel block to be encoded.
In an exemplary embodiment of the present disclosure, the palette information includes a previous palette information and a current palette information, and the determining the palette information of the pixel block to be encoded includes: acquiring the last palette information adopted for coding the pixel block to be coded; acquiring a pixel histogram corresponding to the pixel block to be coded, and determining a pixel mean square value corresponding to the pixel histogram; if the pixel mean square value is larger than the mean square value threshold, matching the pixel value of the pixel block to be coded into the selected pixel code, and calculating a pixel average value; comparing the pixel average value with the previous palette information, and reordering the previous palette information to obtain the current palette information.
In an exemplary embodiment of the present disclosure, the scanning the palette mapping matrix, determining an initial run code according to a scanning result, includes: determining a coding start point and a coding end point based on the palette mapping matrix; scanning the palette mapping matrix to obtain coding intermediate points in the palette mapping matrix; taking the coding cost between the coding starting point and the coding intermediate point as a first coding cost; taking the coding cost between the coding intermediate point and the coding ending point as a second coding cost; determining a target coding cost according to the first coding cost and the second coding cost, wherein the target coding cost is the total coding cost for obtaining the minimum value; the initial run-length encoding is determined based on the target encoding cost.
In an exemplary embodiment of the disclosure, the performing, according to the pixel index value and the scanning manner of the initial run-length encoding, a merging and encoding operation on the initial run-length encoding includes: based on the initial run code, respectively determining a current code run and a next code run which correspond to the current code section and the next code section respectively; if the scanning modes of the current coding run and the next coding run are the same under the condition that the pixel index values corresponding to the current coding run and the next coding run are not equal to the appointed pixel values, carrying out combined coding on the current coding run and the next coding run; and if the scanning modes of the current coding run and the next coding run are different, combining the pixel index value and the coding cost, and executing the merging coding operation on the initial run coding.
In an exemplary embodiment of the disclosure, the combining the pixel index value and the encoding cost performs the merging encoding operation on the initial run-length encoding, including: if the current coding run is the first coding mode, moving a next starting point coordinate corresponding to the next coding run to obtain a next updated starting point coordinate; determining a first combined coding cost of the current coding run and the next coding run according to the next updated starting point coordinate; and taking the next updated starting point coordinate corresponding to the minimum value of the first combined coding cost as the next target starting point coordinate so as to execute the combined coding operation on the initial run-length coding.
In an exemplary embodiment of the disclosure, the combining the pixel index value and the encoding cost performs the merging encoding operation on the initial run-length encoding, and further includes: if the current coding run is the second coding mode, moving the current end point coordinate of the current coding run to obtain the current updated end point coordinate; determining a second combined coding cost of the current coding run and the next coding run according to the current updating end point coordinates; and obtaining a current updated end point coordinate corresponding to the minimum value according to the second combined coding cost as a current target end point coordinate so as to execute the combined coding operation on the initial run-length coding.
In an exemplary embodiment of the present disclosure, the above method further includes: if the next coding run is completely combined, returning to a coding starting point to execute the combined coding operation; if the next coding run is not completely combined, the next coding run is used as the updated current coding run; if the updated current coding run is not the last coding segment, returning to the coding start point to execute the merging coding operation; and if the updated current coding run is the last coding segment, ending the merging coding operation.
According to a second aspect of embodiments of the present disclosure, there is provided a video encoding apparatus including: the pixel block determining module is used for acquiring a video frame to be processed, determining a pixel block to be encoded based on the video frame to be processed, wherein the pixel block to be encoded is a specified pixel block which is subjected to encoding search processing and palette search processing; a mapping matrix determining module, configured to determine palette information of the pixel block to be encoded, where the palette information includes a palette mapping matrix; the initial run Cheng Queding module is used for carrying out scanning treatment on the palette mapping matrix and determining initial run codes according to a scanning result; and the merging and coding module is used for executing merging and coding operation on the initial run code according to the pixel index value and the scanning mode of the initial run code to obtain a video code stream after coding processing.
In an exemplary embodiment of the present disclosure, the pixel block determining module includes a video frame acquisition unit for: acquiring an initial video frame; and performing coding search processing on the initial video frame by adopting a reconstruction coding search step after sequence adjustment to obtain the video frame to be processed, wherein the reconstruction coding search step comprises inter-frame merging operation, inter-frame coding operation, blocking processing operation, intra-frame searching operation and intra-frame block copying operation.
In an exemplary embodiment of the present disclosure, the pixel block determining module includes a pixel block determining unit for: acquiring an initial pixel block based on the video frame to be processed, and determining a coding mode matched with the initial pixel block; if the initial pixel block does not comprise a sub-pixel block and does not need to be subjected to a block processing operation, determining the initial pixel block as the pixel block to be encoded; if the initial pixel block comprises the sub-pixel block and the coding mode of at least one sub-pixel block is a palette mode, determining the initial pixel block as the pixel block to be coded; if the coding mode is an inter-coding mode or a block processing mode, determining the initial pixel block as the pixel block to be coded; if the pixel block size of the initial pixel block is a specified pixel size and the encoding mode is an inter encoding mode, the initial pixel block is determined to be the pixel block to be encoded.
In an exemplary embodiment of the present disclosure, the palette information includes a previous palette information and a current palette information, and the mapping matrix determining module includes a palette acquiring unit for: acquiring the last palette information adopted for coding the pixel block to be coded; acquiring a pixel histogram corresponding to the pixel block to be coded, and determining a pixel mean square value corresponding to the pixel histogram; if the pixel mean square value is larger than the mean square value threshold, matching the pixel value of the pixel block to be coded into the selected pixel code, and calculating a pixel average value; comparing the pixel average value with the previous palette information, and reordering the previous palette information to obtain the current palette information.
In an exemplary embodiment of the present disclosure, the initial run determination module includes an initial run determination unit for: determining a coding start point and a coding end point based on the palette mapping matrix; scanning the palette mapping matrix to obtain coding intermediate points in the palette mapping matrix; taking the coding cost between the coding starting point and the coding intermediate point as a first coding cost; taking the coding cost between the coding intermediate point and the coding ending point as a second coding cost; determining a target coding cost according to the first coding cost and the second coding cost, wherein the target coding cost is the total coding cost for obtaining the minimum value; the initial run-length encoding is determined based on the target encoding cost.
In an exemplary embodiment of the present disclosure, the merging-coding module includes a merging-coding unit for: based on the initial run code, respectively determining a current code run and a next code run which correspond to the current code section and the next code section respectively; if the scanning modes of the current coding run and the next coding run are the same under the condition that the pixel index values corresponding to the current coding run and the next coding run are not equal to the appointed pixel values, carrying out combined coding on the current coding run and the next coding run; and if the scanning modes of the current coding run and the next coding run are different, combining the pixel index value and the coding cost, and executing the merging coding operation on the initial run coding.
In an exemplary embodiment of the present disclosure, the merging-coding unit comprises a first merging-coding subunit for: if the current coding run is the first coding mode, moving a next starting point coordinate corresponding to the next coding run to obtain a next updated starting point coordinate; determining a first combined coding cost of the current coding run and the next coding run according to the next updated starting point coordinate; and taking the next updated starting point coordinate corresponding to the minimum value of the first combined coding cost as the next target starting point coordinate so as to execute the combined coding operation on the initial run-length coding.
In an exemplary embodiment of the present disclosure, the merging-coding unit further comprises a second merging-coding subunit for: if the current coding run is the second coding mode, moving the current end point coordinate of the current coding run to obtain the current updated end point coordinate; determining a second combined coding cost of the current coding run and the next coding run according to the current updating end point coordinates; and obtaining a current updated end point coordinate corresponding to the minimum value according to the second combined coding cost as a current target end point coordinate so as to execute the combined coding operation on the initial run-length coding.
In an exemplary embodiment of the present disclosure, the merging-coding unit further comprises a third merging-coding subunit for: if the next coding run is completely combined, returning to a coding starting point to execute the combined coding operation; if the next coding run is not completely combined, the next coding run is used as the updated current coding run; if the updated current coding run is not the last coding segment, returning to the coding start point to execute the merging coding operation; and if the updated current coding run is the last coding segment, ending the merging coding operation.
According to a third aspect of the present disclosure, there is provided an electronic device comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute instructions to implement the video encoding method of any of the above.
According to a fourth aspect of the present disclosure, there is provided a computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform any one of the video encoding methods described above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the video encoding method of any one of the above.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects: on the one hand, the appointed pixel block which is subjected to coding search processing and palette search processing is taken as the pixel block to be coded, the pixel block which is subjected to search processing by adopting a palette mode is limited, the search time can be compressed as much as possible, and the search efficiency is improved; on the other hand, the initial run-length codes are combined and coded based on the pixel index values and the scanning mode, and the time consumption of palette searching is reduced as much as possible under the condition that the additional distortion is introduced as little as possible.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
Fig. 1 is a diagram illustrating palette information of a current coding unit.
Fig. 2 is a diagram illustrating a mapping matrix obtained by classifying palette information of a current coding unit.
Fig. 3 is a search flow chart of a search process performed by video coding software on a coding unit in a related scheme.
Fig. 4 is a flowchart illustrating a video encoding method according to an exemplary embodiment.
Fig. 5 is a diagram illustrating two kinds of run-length codes employed in coding a mapping matrix according to an exemplary embodiment.
Fig. 6 is a flowchart illustrating the reconstruction code search steps according to an exemplary embodiment.
Fig. 7 is a flowchart illustrating video encoding based on palette mode according to an exemplary embodiment.
Fig. 8 is a block diagram illustrating a video encoding apparatus according to an exemplary embodiment.
Fig. 9 schematically illustrates a block diagram of an electronic device according to an exemplary embodiment of the present disclosure.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
In one video Coding scheme, when performing Coding Unit (CU) search, a video encoder typically inserts a palette (palette) search flow after Intra Block Copy (IBC) search. Referring to fig. 3, fig. 3 is a search flow chart used by video coding software to search for coding units in a related scheme. The method specifically comprises the following steps: step S310, an intra-frame searching operation; step S320, intra block copy operation; step S330, palette searching operation; step S340, interframe merging operation; step S350, inter-frame encoding operation, and step S360, block processing operation. The palette searching operation comprises three steps of palette acquisition, scanning sequence acquisition and run merging; wherein (1) the step of obtaining the palette is to count the pixel types inside the current CU and construct the palette. Here, since the previously used palette is required to be used as much as possible to save the code rate, a plurality of internal iterations are required to confirm which palette is specifically used. (2) The acquire scan order step constructs the scan order using two run-length encodings. For simplicity, the reference software uses a greedy algorithm, using two run-length encodings each time as long as possible, and finally constructs the scan order at the fastest speed. (3) The previous palette (prev_palette) is used more thoroughly in the merge run step, and the three processes can be re-executed up to three times thoroughly. Since excessive use of prev_palette will introduce distortion, re-iterating will trade more distortion for code rate savings.
When the search flow shown in fig. 3 is used for coding, the coding time is doubled and the coding process is too complex under the condition of the same distortion while saving part of code rate. The main aspects are as follows: (1) The palette mode generally does not perform well on larger CUs, and is generally reasonable in smaller areas, so many large block searches are effectively wasted. (2) Although the information of prev_palette looks very high in cost performance, the information of CUs with similar palettes can be well used without one iteration, and more CUs with larger palette differences do not bring more benefits. Either the outer layer iteration or the inner layer iteration wastes a lot of search time. (3) Greedy algorithms are fast algorithms to acquire scan orders, but have low coding compression rates. Although the merged flow is then introduced to catch up with the penalty, the greedy algorithm saves time, and all merged flows are wasted again. (4) The merging flow is too complex and iterates many times, and merging (merge) is performed when escape pixels exist, and distortion is large. (5) The merging flow has only one merging step, so that the previously merged runlength is not repeatedly merged, and the merging can only be considered before the next complete merging code, so that the time is wasted greatly. (6) The whole iterative scheme has a large number of repeated calculations, no reasonable search flow is arranged, and the search time is wasted.
Based on this, according to an embodiment of the present disclosure, a video encoding method, a video encoding apparatus, an electronic device, a computer-readable storage medium, and a computer program product are proposed.
Fig. 4 is a flowchart illustrating a video encoding method according to an exemplary embodiment, and as shown in fig. 4, the video encoding method may be used in a computer device, wherein the computer device described in the present disclosure may include a mobile terminal device such as a mobile phone, a tablet computer, a notebook computer, a palm computer, a Personal digital assistant (Personal DIGITAL ASSISTANT, PDA), and a fixed terminal device such as a desktop computer. The present exemplary embodiment is illustrated with the method applied to a computer device, and it is understood that the method may also be applied to a server, and may also be applied to a system including a computer device and a server, and implemented through interaction of the computer device and the server. The method specifically comprises the following steps.
In step S410, a video frame to be processed is acquired, and a pixel block to be encoded, which is a specified pixel block that has been subjected to the encoding search process and is to be subjected to the palette search process, is determined based on the video frame to be processed.
In one exemplary embodiment of the present disclosure, the video frame to be processed may be a video frame to be compression-encoded. The pixel block to be encoded may be an encoded block made up of encoding units contained in the video frame to be processed. The encoding search process may be a process of performing a pixel search for a pixel block to be encoded using a reconstruction encoding search step. The palette search process may be a process of performing a pixel search on a block of pixels to be encoded using a palette mode to determine an encoding scheme.
In a video transmission scene, such as a screen recording and sharing scene, a video to be transmitted can be acquired, and a video frame to be processed contained in the video to be transmitted is determined so as to perform compression encoding on the video frame to be processed. For the above-mentioned video frame to be processed, a pixel block to be encoded may be determined therefrom, in order to improve the use efficiency of the palette mode and reduce the palette search time as much as possible, an encoding block to which the video encoding scheme of this embodiment is applied is defined, for example, the pixel block to be encoded is a specified pixel block that has undergone an encoding search process and is to undergo a palette search process, the encoding search process in this embodiment is performed based on a reconstruction encoding search step, after the encoding search process, the pixel block to be encoded has completed various types of search processing operations, and only needs to be processed by using the palette mode in the following steps.
In step S420, palette information of the pixel block to be encoded is determined, the palette information including a palette mapping matrix.
In one exemplary embodiment of the present disclosure, the palette information may be related information of all pixels required within the pixel block to be encoded. The palette mapping matrix may be an index matrix for storing palette information corresponding to each position in the block of pixels to be encoded.
After the pixel block to be encoded is obtained, a palette information determination scheme may be adopted to obtain palette information corresponding to the pixel block to be encoded, and reference may be made to fig. 1 specifically; further, classifying and mapping the palette information to obtain a palette mapping matrix corresponding to the pixel block to be encoded, referring to fig. 2 specifically.
In step S430, the palette mapping matrix is scanned, and initial run-length encoding is determined based on the scanning result.
In one exemplary embodiment of the present disclosure, the initial run-length coding may be a coding scheme obtained by coding a mapping matrix using two run-length codes provided in a palette mode.
Palette mode in encoding the mapping matrix, in order to save the code rate, various scanning methods will be used, and two run-length encoding methods are used in consideration of the similarity of local pixels, and referring to fig. 5, fig. 5 is a schematic diagram illustrating two run-length encodings used in encoding the mapping matrix according to an exemplary embodiment. (1) The Left pixel (Copy Left) is copied, along the scan direction, if there are several identical indices, e.g. "1 111 111 1", then encoded as "8 1". (2) The upper pixel (Copy Above) is copied, perpendicular to the scan direction, and if there are several identical indices in the upper line, then the code is "there are x identical indices with the upper line". This coding scheme does not require what the Index is specifically coded, so the code rate is more saved. But this approach must follow the Copy Left mode, two linked Copy Above modes are meaningless.
And scanning the palette mapping matrix to obtain pixel value index values contained in the palette mapping matrix, and further carrying out coding treatment on the palette mapping matrix by adopting the provided run code according to the pixel index values to obtain an initial run code.
In step S440, the merging and encoding operation is performed on the initial run-length encoding according to the pixel index value and the scanning mode of the initial run-length encoding, so as to obtain the video code stream after the encoding process.
In one exemplary embodiment of the present disclosure, the pixel index value may be a specific value of a pixel index held in the palette mapping matrix. The scanning method may be a pixel scanning method corresponding to a run code included in the initial run code, and the scanning method includes a first scanning method along a scanning direction (Copy Left) and a second scanning method perpendicular to the scanning direction (Copy Above). The merge coding operation may be a coding operation that performs a merge process on a run that can be merged in the initial run coding. The video code stream may be a compressed code stream obtained by the above-mentioned encoding process.
After the initial coding run is obtained, the initial run coding may be subjected to a merge coding process for further compression of the video coding. Considering that the pixel index value is escAN_SNe (i.e. there is an escAN_SNe pixel), distortion caused by merging encoding is still performed, during merging encoding processing, whether merging encoding can be performed on the run-length encoding of the initial encoding section can be judged according to the pixel index value and the scanning mode of the initial run-length encoding, and if the pixel index value is escAN_SNe, merging encoding is not performed. And if the run-length codes capable of being combined and coded exist in the initial coding section, combining and coding processing is carried out to obtain a compressed video code stream after coding processing.
According to the video encoding method in the present exemplary embodiment, on the one hand, for a specified pixel block that has undergone the encoding search process and is to be subjected to the palette search process as a pixel block to be encoded, a pixel block that is to be subjected to the search process using the palette mode is defined, so that the search time can be compressed as much as possible, and the search efficiency can be improved; on the other hand, the initial run-length codes are combined and coded based on the pixel index values and the scanning mode, and the time consumption of palette searching is reduced as much as possible under the condition that the additional distortion is introduced as little as possible.
Next, a video encoding method in the present exemplary embodiment will be further described.
In an exemplary embodiment of the present disclosure, for step S410, acquiring a video frame to be processed includes: acquiring an initial video frame; and performing coding search processing on the initial video frame by adopting a reconstruction coding search step after sequence adjustment to obtain a video frame to be processed, wherein the reconstruction coding search step comprises inter-frame merging operation, inter-frame coding operation, blocking processing operation, intra-frame searching operation and intra-frame block copying operation.
The reconstruction code searching step may be a searching step obtained by sequentially adjusting sub-processes included in an existing coding unit (e.g., pixel block) searching process.
In order to further reduce the search time generated by decision encoding using the palette mode, the video decoder performs a sequence adjustment operation on the search flow in fig. 3 in this embodiment to obtain a reconstructed code search step, and referring to fig. 6, fig. 6 is a flowchart illustrating the reconstructed code search step according to an exemplary embodiment. Specifically, the sequence of the intra-frame searching operation (INTRA SEARCH), the intra-block copying operation (IBC search) and the palette searching operation (PALETTE SEARCH) is adjusted to the end of the whole searching process, namely, after the Inter-frame merging operation (INTER MERGE), the Inter-frame coding operation (Inter) and the block processing operation (Split), so as to obtain a reconstruction coding searching step, which comprises the following steps: step S610, interframe merging operation; step S620, inter-frame coding operation; step S630, partitioning processing operation; step S640, an intra-frame searching operation; step S650, intra block copy operation; step S660, palette searching operation.
After the initial video frame is obtained, the initial video frame can be searched in the reconstruction coding searching step, the optimal coding mode matched with each pixel block to be coded is determined, and then the video frame to be processed suitable for the palette mode is determined from the initial video frame according to the coding modes of different pixel blocks to be coded. Through the searching step, the pixel block suitable for using the palette mode can be determined, and then the palette decision is adopted for encoding.
In one exemplary embodiment of the present disclosure, for step S410, determining a block of pixels to be encoded based on a video frame to be processed includes: acquiring an initial pixel block based on a video frame to be processed, and determining a coding mode matched with the initial pixel block; if the initial pixel block does not comprise the sub-pixel block and the block processing operation is not needed, determining the initial pixel block as a pixel block to be encoded; if the initial pixel block comprises sub-pixel blocks and the coding mode of at least one sub-pixel block is a palette mode, determining the initial pixel block as a pixel block to be coded; if the coding mode is an inter-coding mode or a block processing mode, determining the initial pixel block as a pixel block to be coded; if the pixel block size of the initial pixel block is the specified pixel size and the encoding mode is an inter encoding mode, the initial pixel block is determined to be the pixel block to be encoded.
The initial pixel block may be a pixel block obtained by performing segmentation processing on a video frame to be processed. The coding mode may be a specific mode employed for the search processing of the initial pixel block. The blocking processing operation may be an operation of dividing the initial pixel block into pixel blocks of smaller size. The sub-pixel block may be a pixel block obtained by performing a block processing operation on the initial pixel block. The pixel block size may be a specific size of the initial pixel block.
And carrying out search processing on the initial video frame by adopting a reconstruction coding search step, determining a coding mode matched with the pixel block, determining the coding mode matched with the initial pixel block, and further selecting a pixel block to be coded which is suitable for palette mode decision coding from the initial pixel block. The specific rules are as follows: if the initial block of pixels does not include a sub-block of pixels and does not require a block processing operation (Split), the initial block of pixels is deemed suitable for encoding using the palette mode, and the initial block of pixels is determined as a block of pixels to be encoded. If the initial pixel block comprises a sub-pixel block, judging a coding mode corresponding to the sub-pixel block, and when at least one coding mode of the sub-pixel block is a palette mode, determining the initial pixel block as a pixel block to be coded by considering that the initial pixel block can be coded by adopting a palette mode decision.
After the search processing, the current matched optimal coding mode is an inter-frame coding mode or a block processing mode, and the initial pixel block can be determined as a pixel block to be coded; if the initial pixel block is a larger block, e.g., the pixel block size is a specified pixel size (e.g., 32 x 32), and the coding mode is an inter coding mode, the initial pixel block is determined to be the pixel block to be coded. Because the palette mode searches over a plurality of large blocks with performance waste, in this embodiment, the palette mode is used to perform the search processing on the pixel blocks meeting the corresponding conditions, so as to overcome the problem that the palette mode has poor performance on a larger CU, and because the palette mode is generally reasonable in a smaller area, the palette search operation (PALETTE SEARCH) is performed on the pixel blocks meeting any one of the conditions, so as to fully exert the search performance of the palette mode.
In an exemplary embodiment of the present disclosure, for step S420, determining palette information for a pixel block to be encoded includes: acquiring the last palette information adopted for coding the pixel block to be coded; acquiring a pixel histogram corresponding to a pixel block to be coded, and determining a pixel mean square value corresponding to the pixel histogram; if the mean square value of the pixel is larger than the mean square value threshold, matching the pixel value of the pixel block to be coded into the selected pixel code, and calculating a pixel average value; and comparing the pixel average value with the previous palette information, and reordering the previous palette information to obtain the current palette information.
The previous palette information may be palette information already existing when palette coding the pixel block to be coded. The pixel mean square value may be a pixel mean value calculated from a pixel histogram of the pixel block to be encoded. The mean square threshold may be a pre-configured reference value for comparison with the mean square of the pixel. The selected pixel code may be pixel information contained in palette information, i.e., pixel information already present in the last palette mapping matrix. The pixel average value may be an average value of pixels calculated from the previous palette information. The current palette information may be currently used palette information obtained by updating the previous palette information.
Prior to encoding a block of pixels to be encoded, palette information for the block of pixels to be encoded may be determined, as shown with particular reference to fig. 7, fig. 7 is a flowchart illustrating video encoding based on a palette mode, according to an exemplary embodiment. In step S701, the color type inside the current coding unit is counted. And obtaining a pixel histogram corresponding to the pixel block to be encoded, determining peaks contained in the pixel histogram, and further calculating pixel mean square values corresponding to a plurality of peaks in the pixel histogram. After the pixel mean square value is obtained through calculation, comparing the pixel mean square value with a preset mean square value threshold, and if the pixel mean square value is smaller than or equal to the mean square value threshold, indicating that no obvious peak value exists in the pixel block to be encoded, wherein the processing step of the pixel block to be encoded can be ended. In step S702, a significant spike is found and a spike pixel value is selected. If the mean square value of the pixels is larger than the mean square value threshold value, the existence of obvious peaks in the pixel block to be encoded is indicated, and at the moment, palette information of the pixel block to be encoded can be obtained.
Specifically, the last palette information corresponding to the pixel block to be encoded, i.e., prev_palette, is obtained, in step S703, the pixel values of the pixel block to be encoded are matched to the selected pixel code (codeChoesn), and the pixel average value is calculated. In step S704, the CU pixels in the palette are approximated to the previous palette prev_palette. In step S705, the average value of the pixels is compared with the previous palette information, and the current palette information is obtained after reordering the previous palette information.
Although the information of prev_palette looks high in cost performance, the information of the CUs with similar palettes can be well used without one iteration, and more returns cannot be brought by more iterations of CUs with larger palette differences. Thus, in analyzing the pixels of the current CU, if the pixel histogram does not have particularly pronounced spike features, the following palette search flow is not uniformly performed. In addition, in the prev_palette application process, more than one iteration is required when any of the following conditions is satisfied: (1) block size = 8 x 8; (2) The current block is not the first palette searched CU in the current CTU. The specific reasons are as follows: if the information is the first palette of the current CTU, it is difficult to use the information of the previous_palette; the iteration time of the large block is too long and the cost performance is too low. By limiting the condition of determining the current palette information by using the prev_palette, the problem of lower cost performance caused in the process of determining the palette information can be effectively solved, so that the searching efficiency is further improved, and the searching time is reduced.
In an exemplary embodiment of the present disclosure, for step S430, scanning the palette mapping matrix, determining an initial run-length code according to a scan result, includes: determining a coding start point and a coding end point based on the palette mapping matrix; scanning the palette mapping matrix to obtain coding intermediate points in the palette mapping matrix; taking the coding cost between the coding starting point and the coding intermediate point as a first coding cost; taking the coding cost between the coding intermediate point and the coding ending point as a second coding cost; determining a target coding cost according to the first coding cost and the second coding cost, wherein the target coding cost is the total coding cost for obtaining the minimum value; an initial run-length encoding is determined based on the target encoding cost.
The coding start point may be the start coordinate of video coding in the palette mapping matrix. The coding termination point may be the end coordinates of video coding in the palette mapping matrix. The coding intermediate points may be coordinates of any pixel point in the palette mapping matrix that is video coded. The first encoding cost may be an encoding cost between the encoding start point and the encoding intermediate point. The second encoding cost may be an encoding cost between the encoding middle point and the encoding end point. The total coding cost may be a coding cost from a coding start point to a coding end point. The target coding cost may be a coding cost corresponding to when the total coding cost takes a minimum value.
When the greedy algorithm is adopted to search the optimal path, the greedy algorithm has high algorithm speed for acquiring the scanning sequence, but the coding compression rate is low, the merging flow is introduced later to compensate the loss of the low compression rate, and the greedy algorithm saves time and is consumed by the merging flow. In order to overcome the above-mentioned drawbacks, in the process of searching the best path, a scheme of determining the best path by adopting dynamic programming and further determining the minimum coding cost is proposed. The method comprises the following steps:
With continued reference to fig. 7, a dynamic programming scheme is employed to determine the best path for the palette mapping matrix. In step S706, a palette mapping matrix is acquired, an encoding start point and an encoding end point are determined, and an index matrix is acquired, i=0; starting from i=1, let dp [1] =cost_copy_left [0] [1] as the initial total coding cost. In step S707, coding intermediate points are determined, and coding costs corresponding to each intermediate point are calculated in a loop. For example, the palette mapping matrix is scanned to obtain each coding intermediate point in the palette mapping matrix, and the coding cost is calculated. Specifically, in one loop, j= … i-1, the possible run from j- > i is determined, and if not, the path cost (cost) is considered to be infinite.
When the total coding cost is determined, the coding cost between the coding starting point and the coding intermediate point is used as a first coding cost; the coding cost between the coding intermediate point and the coding end point is used as a second coding cost to calculate the current optimal cost [ j ] =min (cost_copy_left [ j ] [ i-j ], cost_copy_above [ j ] [ i-j ]). The above coding cost calculation step is repeated continuously, and in step S708, the coding intermediate point and the run type corresponding to the lowest coding cost are selected. According to the first coding cost and the second coding cost obtained by calculation, determining a target coding cost which enables the total coding cost to obtain the minimum value, namely, finding a run of j- > i with the minimum cost [ j ] +dp [ j ] in all j, and updating dp [ i ] =MIN (cost [ j ] +dp [ j ]). In the step S709, the coding costs corresponding to the different intermediate points may be calculated by continuously moving the index points, and the coding run corresponding to the minimum value of the total coding costs may be determined by the above-mentioned processing steps, so as to reduce the time consumption of searching in the coding process.
In an exemplary embodiment of the present disclosure, for step S440, performing a merging and encoding operation on an initial run-length encoding according to a pixel index value and a scanning manner of the initial run-length encoding, includes: based on the initial run coding, respectively determining a current coding run and a next coding run which correspond to the current coding section and the next coding section respectively; under the condition that the pixel index values corresponding to the current coding run and the next coding run are not equal to the appointed pixel value, if the scanning modes of the current coding run and the next coding run are the same, merging and coding the current coding run and the next coding run; if the scanning modes of the current coding run and the next coding run are different, combining the pixel index value and the coding cost to execute the merging coding operation on the initial run coding.
Wherein the current coding segment may be a pixel index segment currently scanned by the video encoder. The next encoded segment may be a segment of the pixel index that the video encoder is about to scan, immediately following the current encoded segment. The current coding run may be a coding run corresponding to the current coding segment. The next coding run may be a coding run corresponding to the next coding segment. The specified pixel value may be a preconfigured pixel value. The encoding cost may be a cost resulting from an encoding operation between one pixel point coordinate and another pixel point coordinate.
After the initial run-length codes are obtained, the initial run-length codes may be further combined and coded, and with continued reference to fig. 7, in step S710, a current coding run-length curr corresponding to the current coding segment is determined from the initial run-length codes, and in step S711, a next coding run-length next corresponding to the next coding segment is determined. Considering the existing merging flow, the pixel index value is escape (i.e. there is an escape pixel), and the distortion caused by merging encoding is still performed. After the coding run capable of carrying out the merging operation is screened out, the scanning mode of the coding run can be further acquired, and the specific merging operation is determined according to the scanning mode.
In step S712, it is determined whether the scanning modes of the current coding run curr and the next coding run next are consistent, and if they are consistent, the current coding run curr and the next coding run next are combined and coded. For example, if the current coding run curr and the next coding run next are both the first scanning mode left or the second scanning mode above, and neither of the pixel index values is escape, the current coding run curr and the next coding run next are merged, and the first step of the merging process is returned. If the scanning modes of the current coding run curr and the next coding run next are different, the pixel index value and the coding cost are further combined to determine a specific combined coding scheme of the initial run coding. By the above-mentioned merging flow, the additional distortion caused by merging when escape exists in the initial run-length coding can be avoided, and the merging coding scheme with the minimum coding cost can be determined.
In one exemplary embodiment of the present disclosure, combining the pixel index value with the encoding cost performs a merge encoding operation on the initial run-length encoding, including: if the current coding run is the first coding mode, moving a next starting point coordinate corresponding to the next coding run to obtain a next updated starting point coordinate; determining a first combined coding cost of a current coding run and a next coding run according to the next updated starting point coordinate; and taking the next updated starting point coordinate corresponding to the minimum value of the first merging coding cost as the next target starting point coordinate so as to execute merging coding operation on the initial run-length coding.
The first encoding method may be an encoding method along the scanning direction. The next updated starting point coordinate may be a coordinate position obtained by updating the starting point coordinate of the next coding run. The first combined coding cost may be a coding cost corresponding to combining coding processing of the current coding run and the next coding run on the premise that the current coding run is the first coding mode. The next target start point coordinate may be a coordinate position at which the first merging coding cost determined from the plurality of next updated start point coordinates takes a minimum value.
In the case that the current coding run curr and the next coding run next are both not escape and the scanning modes of the two are different, it is determined whether the current coding run curr is the first coding mode left, in step S713, if the current coding run curr is the first coding mode left, in step S714, the beginning position (i.e., the next start point coordinate) corresponding to the next coding run next is moved, so as to obtain the next updated start point coordinate after the movement update. Further, according to the next updated starting point coordinates, determining a first merging coding cost (merging cost) between the current coding run curr and the next coding run next; and when the first combined coding cost obtains the minimum value, determining the beginning position of the next coding run next as the next target starting point coordinate. And then, based on the next target starting point coordinates, performing a merging coding operation on the initial run-length codes. By the combination flow, the coding cost generated by the coding scheme can be minimized.
In an exemplary embodiment of the present disclosure, combining the pixel index value with the encoding cost, performing a merge encoding operation on the initial run-length encoding, further includes: if the current coding run is the second coding mode, moving the current end point coordinate of the current coding run to obtain the current updated end point coordinate; determining a second combined coding cost of the current coding run and the next coding run according to the current updating end point coordinates; and obtaining the current updated end point coordinate corresponding to the minimum value according to the second merging coding cost as the current target end point coordinate so as to execute merging coding operation on the initial run-length coding.
The second encoding method may be a encoding method perpendicular to the scanning direction. The current updated end point coordinate may be a coordinate position obtained after updating the end point coordinate of the current coding run. The second merging coding cost may be a coding cost corresponding to merging coding processing of the current coding run and the next coding run on the premise that the current coding run is in the second coding mode. The current target destination coordinate may be a coordinate position at which a minimum value is obtained from a second merge coding cost determined from the plurality of current updated destination coordinates.
With continued reference to fig. 7, in the case where the current coding run curr and the next coding run next are not escape and the scanning modes are different, if the current coding run curr is the second coding mode above, the cost generated by the above coding mode is lower than the left coding mode by default, so in step S715, the end position (i.e., the current end point coordinate) corresponding to the current coding run curr can be moved as much as possible, and the current updated end point coordinate after the movement update is obtained. Further, determining a start point coordinate corresponding to the next coding run next according to the current updated end point coordinate, and calculating a second merging coding cost (merging cost) between the current coding run curr and the next coding run next; and when the second combined coding cost obtains the minimum value, determining the beginning position of the next coding run next as the next target starting point coordinate. And then, based on the next target starting point coordinates, performing a merging coding operation on the initial run-length codes. By the combination flow, the coding cost generated by the coding scheme can be minimized.
In one exemplary embodiment of the present disclosure, if the next encoding run is completely merged, returning to the encoding start point to perform the merge encoding operation; if the next coding run is not completely combined, taking the next coding run as the updated current coding run; if the updated current coding run is not the last coding segment, returning to the coding start point to execute the combined coding operation; and if the updated current coding run is the last coding section, ending the merging coding operation.
After the merging operation is finished, further determining whether the next coding run next is completely merged during the merging operation, with continued reference to fig. 7, in step S716, determining whether the next coding run next is completely merged, and if the next coding run next is completely merged, returning to the first step of the merging flow; if the next coding run next is not completely merged, in step S717, the current coding run is updated, letting curr=next; further, in step S718, it is determined whether the current coding run curr is the last coding segment; if the current coding run curr is not the last coding segment, returning to the coding starting point to execute the combined coding operation; if the updated current coding run curr is the last coding segment, the merge coding operation is ended. The merging flow adopts palette search, and no further repeated iteration exists, so that the whole merging flow avoids a large number of repeated calculations, and the searching time can be effectively saved.
In summary, in the video encoding method of the present disclosure, a video frame to be processed is obtained, a pixel block to be encoded is determined based on the video frame to be processed, and the pixel block to be encoded is a specified pixel block that has undergone encoding search processing and is to be subjected to palette search processing; determining palette information of a pixel block to be encoded, the palette information including a palette mapping matrix; scanning the palette mapping matrix, and determining an initial run code according to a scanning result; and executing merging coding operation on the initial run-length codes according to the pixel index values and the scanning modes of the initial run-length codes to obtain coded video code streams. On the one hand, the appointed pixel block which is subjected to coding search processing and palette search processing is taken as the pixel block to be coded, the pixel block which is subjected to search processing by adopting a palette mode is limited, the search time can be compressed as much as possible, and the search efficiency is improved; on the other hand, the initial run-length codes are combined and coded based on the pixel index values and the scanning mode, and the time consumption of palette searching is reduced as much as possible under the condition that the additional distortion is introduced as little as possible. In yet another aspect, the palette tool is used with the highest efficiency by compressing its search time as much as possible while preserving the compression performance of the palette tool as much as possible.
Fig. 8 is a block diagram of a video encoding apparatus according to an exemplary embodiment. Referring to fig. 8, the video encoding apparatus 800 includes: a pixel block determination module 810, a mapping matrix determination module 820, an initial run determination module 830, and a merge coding module 840.
Specifically, the pixel block determining module 810 is configured to obtain a video frame to be processed, determine a pixel block to be encoded based on the video frame to be processed, where the pixel block to be encoded is a specified pixel block that has undergone an encoding search process and is to be subjected to a palette search process; a mapping matrix determining module 820 for determining palette information of the pixel block to be encoded, the palette information including a palette mapping matrix; an initial run determining module 830, configured to scan the palette mapping matrix, and determine an initial run code according to a scan result; the merging and encoding module 840 is configured to perform merging and encoding operations on the initial run-length codes according to the pixel index values and the scanning modes of the initial run-length codes, so as to obtain the video code stream after the encoding process.
In one exemplary embodiment of the present disclosure, the pixel block determination module 810 includes a video frame acquisition unit for: acquiring an initial video frame; and performing coding search processing on the initial video frame by adopting a reconstruction coding search step after sequence adjustment to obtain a video frame to be processed, wherein the reconstruction coding search step comprises inter-frame merging operation, inter-frame coding operation, blocking processing operation, intra-frame searching operation and intra-frame block copying operation.
In one exemplary embodiment of the present disclosure, the pixel block determining module 810 includes a pixel block determining unit for: acquiring an initial pixel block based on a video frame to be processed, and determining a coding mode matched with the initial pixel block; if the initial pixel block does not comprise the sub-pixel block and the block processing operation is not needed, determining the initial pixel block as a pixel block to be encoded; if the initial pixel block comprises sub-pixel blocks and the coding mode of at least one sub-pixel block is a palette mode, determining the initial pixel block as a pixel block to be coded; if the coding mode is an inter-coding mode or a block processing mode, determining the initial pixel block as a pixel block to be coded; if the pixel block size of the initial pixel block is the specified pixel size and the encoding mode is an inter encoding mode, the initial pixel block is determined to be the pixel block to be encoded.
In an exemplary embodiment of the present disclosure, the palette information includes a previous palette information and a current palette information, and the mapping matrix determining module 820 includes a palette acquiring unit for: acquiring the last palette information adopted for coding the pixel block to be coded; acquiring a pixel histogram corresponding to a pixel block to be coded, and determining a pixel mean square value corresponding to the pixel histogram; if the mean square value of the pixel is larger than the mean square value threshold, matching the pixel value of the pixel block to be coded into the selected pixel code, and calculating a pixel average value; and comparing the pixel average value with the previous palette information, and reordering the previous palette information to obtain the current palette information.
In an exemplary embodiment of the present disclosure, the initial run determination module 830 includes an initial run determination unit for: determining a coding start point and a coding end point based on the palette mapping matrix; scanning the palette mapping matrix to obtain coding intermediate points in the palette mapping matrix; taking the coding cost between the coding starting point and the coding intermediate point as a first coding cost; taking the coding cost between the coding intermediate point and the coding ending point as a second coding cost; determining a target coding cost according to the first coding cost and the second coding cost, wherein the target coding cost is the total coding cost for obtaining the minimum value; an initial run-length encoding is determined based on the target encoding cost.
In one exemplary embodiment of the present disclosure, the merge coding module 840 includes a merge coding unit for: based on the initial run coding, respectively determining a current coding run and a next coding run which correspond to the current coding section and the next coding section respectively; under the condition that the pixel index values corresponding to the current coding run and the next coding run are not equal to the appointed pixel value, if the scanning modes of the current coding run and the next coding run are the same, merging and coding the current coding run and the next coding run; if the scanning modes of the current coding run and the next coding run are different, combining the pixel index value and the coding cost to execute the merging coding operation on the initial run coding.
In an exemplary embodiment of the present disclosure, the merging-coding unit comprises a first merging-coding subunit for: if the current coding run is the first coding mode, moving a next starting point coordinate corresponding to the next coding run to obtain a next updated starting point coordinate; determining a first combined coding cost of a current coding run and a next coding run according to the next updated starting point coordinate; the next updated starting point coordinate corresponding to the minimum value is obtained from the first combined coding cost and is used as the next target starting point coordinate; and performing merging coding operation on the initial run-length coding based on the next target starting point coordinates.
In an exemplary embodiment of the present disclosure, the merging-coding unit further comprises a second merging-coding subunit for: if the current coding run is the second coding mode, moving the current end point coordinate of the current coding run to obtain the current updated end point coordinate; determining a second combined coding cost of the current coding run and the next coding run according to the current updating end point coordinates; and obtaining the current updated end point coordinate corresponding to the minimum value according to the second merging coding cost as the current target end point coordinate so as to execute merging coding operation on the initial run-length coding.
In an exemplary embodiment of the present disclosure, the merging-coding unit further comprises a third merging-coding subunit for: if the next coding run is completely merged, returning to the coding starting point to execute the merging coding operation; if the next coding run is not completely combined, taking the next coding run as the updated current coding run; if the updated current coding run is not the last coding segment, returning to the coding start point to execute the combined coding operation; and if the updated current coding run is the last coding section, ending the merging coding operation.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
An electronic device 900 according to such an embodiment of the present disclosure is described below with reference to fig. 9. The electronic device 900 shown in fig. 9 is merely an example and should not be construed to limit the functionality and scope of use of embodiments of the present disclosure in any way.
As shown in fig. 9, the electronic device 900 is embodied in the form of a general purpose computing device. Components of electronic device 900 may include, but are not limited to: the at least one processing unit 910, the at least one storage unit 920, a bus 930 connecting the different system components (including the storage unit 920 and the processing unit 910), and a display unit 940.
Wherein the storage unit stores program code that is executable by the processing unit 910 such that the processing unit 910 performs steps according to various exemplary embodiments of the present disclosure described in the above-described "exemplary methods" section of the present specification.
The storage unit 920 may include readable media in the form of volatile storage units, such as Random Access Memory (RAM) 921 and/or cache memory 922, and may further include Read Only Memory (ROM) 923.
The storage unit 920 may include a program/utility 924 having a set (at least one) of program modules 925, such program modules 925 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
Bus 930 may represent one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 900 may also communicate with one or more external devices 970 (e.g., keyboard, pointing device, bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 900, and/or any device (e.g., router, modem, etc.) that enables the electronic device 900 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 950. Also, electronic device 900 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through network adapter 960. As shown, the network adapter 960 communicates with other modules of the electronic device 900 over the bus 930. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 900, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
In an exemplary embodiment, a computer readable storage medium is also provided, such as a memory, comprising instructions executable by a processor of an apparatus to perform the video encoding method described above. Alternatively, the computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
In an exemplary embodiment, a computer program product is also provided, comprising a computer program/instruction, characterized in that the computer program/instruction, when executed by a processor, implements the video encoding method of any of the above.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (13)

1. A video encoding method, comprising:
Acquiring a video frame to be processed, and determining a pixel block to be encoded based on the video frame to be processed, wherein the pixel block to be encoded is a specified pixel block which is subjected to encoding search processing and palette search processing;
determining palette information of the pixel block to be encoded, the palette information including a palette mapping matrix;
scanning the palette mapping matrix, and determining initial run coding according to a scanning result;
And executing merging coding operation on the initial run code according to the pixel index value and the scanning mode of the initial run code to obtain a video code stream after coding processing.
2. The method of claim 1, wherein the acquiring the video frame to be processed comprises:
Acquiring an initial video frame;
and performing coding search processing on the initial video frame by adopting a reconstruction coding search step after sequence adjustment to obtain the video frame to be processed, wherein the reconstruction coding search step comprises inter-frame merging operation, inter-frame coding operation, blocking processing operation, intra-frame searching operation and intra-frame block copying operation.
3. The method according to claim 1 or 2, wherein said determining a block of pixels to be encoded based on said video frame to be processed comprises:
Acquiring an initial pixel block based on the video frame to be processed, and determining a coding mode matched with the initial pixel block;
If the initial pixel block does not comprise a sub-pixel block and does not need to be subjected to a block processing operation, determining the initial pixel block as the pixel block to be encoded;
If the initial pixel block comprises the sub-pixel block and the coding mode of at least one sub-pixel block is a palette mode, determining the initial pixel block as the pixel block to be coded;
If the coding mode is an inter-coding mode or a block processing mode, determining the initial pixel block as the pixel block to be coded;
If the pixel block size of the initial pixel block is a specified pixel size and the encoding mode is an inter encoding mode, the initial pixel block is determined to be the pixel block to be encoded.
4. The method of claim 1, wherein the palette information comprises a previous palette information and a current palette information, the determining palette information for the block of pixels to be encoded comprising:
Acquiring the last palette information adopted for coding the pixel block to be coded;
acquiring a pixel histogram corresponding to the pixel block to be coded, and determining a pixel mean square value corresponding to the pixel histogram;
If the pixel mean square value is larger than the mean square value threshold, matching the pixel value of the pixel block to be coded into the selected pixel code, and calculating a pixel average value;
comparing the pixel average value with the previous palette information, and reordering the previous palette information to obtain the current palette information.
5. The method of claim 1, wherein scanning the palette mapping matrix, determining an initial run code based on a scan result, comprises:
determining a coding start point and a coding end point based on the palette mapping matrix;
Scanning the palette mapping matrix to obtain coding intermediate points in the palette mapping matrix;
taking the coding cost between the coding starting point and the coding intermediate point as a first coding cost;
taking the coding cost between the coding intermediate point and the coding ending point as a second coding cost;
Determining a target coding cost according to the first coding cost and the second coding cost, wherein the target coding cost is the total coding cost for obtaining the minimum value;
the initial run-length encoding is determined based on the target encoding cost.
6. The method of claim 1, wherein performing a merge encoding operation on the initial run-length code according to the pixel index value and the scanning manner of the initial run-length code comprises:
based on the initial run code, respectively determining a current code run and a next code run which correspond to the current code section and the next code section respectively;
if the scanning modes of the current coding run and the next coding run are the same under the condition that the pixel index values corresponding to the current coding run and the next coding run are not equal to the appointed pixel values, carrying out combined coding on the current coding run and the next coding run;
And if the scanning modes of the current coding run and the next coding run are different, combining the pixel index value and the coding cost, and executing the merging coding operation on the initial run coding.
7. The method of claim 6, wherein said combining the pixel index value with the encoding cost performs the merge encoding operation on the initial run-length encoding, comprising:
If the current coding run is the first coding mode, moving a next starting point coordinate corresponding to the next coding run to obtain a next updated starting point coordinate;
Determining a first combined coding cost of the current coding run and the next coding run according to the next updated starting point coordinate;
and taking the next updated starting point coordinate corresponding to the minimum value of the first combined coding cost as the next target starting point coordinate so as to execute the combined coding operation on the initial run-length coding.
8. The method of claim 6, wherein said combining the pixel index value with the encoding cost performs the merge encoding operation on the initial run-length encoding, further comprising:
If the current coding run is the second coding mode, moving the current end point coordinate of the current coding run to obtain the current updated end point coordinate;
determining a second combined coding cost of the current coding run and the next coding run according to the current updating end point coordinates;
and obtaining a current updated end point coordinate corresponding to the minimum value according to the second combined coding cost as a current target end point coordinate so as to execute the combined coding operation on the initial run-length coding.
9. The method according to claim 7 or 8, characterized in that the method further comprises:
if the next coding run is completely combined, returning to a coding starting point to execute the combined coding operation;
if the next coding run is not completely combined, the next coding run is used as the updated current coding run;
If the updated current coding run is not the last coding segment, returning to the coding start point to execute the merging coding operation;
and if the updated current coding run is the last coding segment, ending the merging coding operation.
10. A video encoding apparatus, comprising:
The pixel block determining module is used for acquiring a video frame to be processed, determining a pixel block to be encoded based on the video frame to be processed, wherein the pixel block to be encoded is a specified pixel block which is subjected to encoding search processing and palette search processing;
A mapping matrix determining module, configured to determine palette information of the pixel block to be encoded, where the palette information includes a palette mapping matrix;
An initial run Cheng Queding module, configured to scan the palette mapping matrix, and determine an initial run code according to a scan result;
And the merging and coding module is used for executing merging and coding operation on the initial run code according to the pixel index value and the scanning mode of the initial run code to obtain a video code stream after coding processing.
11. An electronic device, comprising:
A processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the video coding method of any one of claims 1 to 9.
12. A computer readable storage medium, characterized in that instructions in the computer readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the video encoding method of any one of claims 1 to 9.
13. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the video encoding method of any one of claims 1 to 9.
CN202410199540.0A 2024-02-22 2024-02-22 Video encoding method, video encoding device, electronic device, storage medium, and program product Pending CN117939153A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410199540.0A CN117939153A (en) 2024-02-22 2024-02-22 Video encoding method, video encoding device, electronic device, storage medium, and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410199540.0A CN117939153A (en) 2024-02-22 2024-02-22 Video encoding method, video encoding device, electronic device, storage medium, and program product

Publications (1)

Publication Number Publication Date
CN117939153A true CN117939153A (en) 2024-04-26

Family

ID=90764564

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410199540.0A Pending CN117939153A (en) 2024-02-22 2024-02-22 Video encoding method, video encoding device, electronic device, storage medium, and program product

Country Status (1)

Country Link
CN (1) CN117939153A (en)

Similar Documents

Publication Publication Date Title
CN111145090B (en) Point cloud attribute coding method, point cloud attribute decoding method, point cloud attribute coding equipment and point cloud attribute decoding equipment
US7769237B2 (en) Dynamic, locally-adaptive, lossless palettization of color and grayscale images
CN109379598B (en) Image lossless compression method based on FPGA
CN111163322B (en) Encoding and decoding method for mapping index based on historical motion vector
KR20010019442A (en) Motion compensating method in object based quad-tree mesh using greedy algorithm
JP4101034B2 (en) Encoding apparatus and method
CN112672149A (en) Video processing method and device, storage medium and server
CN107682699B (en) A kind of nearly Lossless Image Compression method
CN112702600B (en) Image coding and decoding neural network layered fixed-point method
JPH09327019A (en) Object area encoding device
CN112637600A (en) Method and apparatus for encoding and decoding data with lossy or lossless compression
CN117939153A (en) Video encoding method, video encoding device, electronic device, storage medium, and program product
CN113365080B (en) Encoding and decoding method, device and storage medium for string coding technology
KR20060128586A (en) Apparatus for encoding and decoding image, and method thereof, and a recording medium storing program to implement the method
CN112509107B (en) Point cloud attribute re-coloring method, device and encoder
CN113347437B (en) Encoding method, encoder, decoder and storage medium based on string prediction
WO2022227082A1 (en) Block division methods, encoders, decoders, and computer storage medium
Li et al. Fractal color image compression
JP3432039B2 (en) Image encoding method and apparatus
KR20230074504A (en) Point cloud encoding method, point cloud decoding method and related device
JPH118848A (en) Image encoding method and device therefor
JP2000299866A (en) Method for encoding image
CN113573078B (en) Method for enhancing AVS intra-frame decoding based on convolutional neural network
US20240121439A1 (en) Point cloud attribute information encoding method and apparatus, point cloud attribute information decoding method and apparatus, and related device
Lopes et al. Image coding with neural network-based colorization

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination