Encoding and decoding method, device and equipment thereof
By dividing the slices in the video encoding process into multiple blocks and interleaved coding, the storage resources and delay problems required for slice bitstream buffering in high-resolution video encoding are solved, and multi-slice parallel decoding is realized in low-latency scenarios.
Patent Information
- Application Number
- JP2024555204
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2022-03-18
- Filing Date
- 2023-03-17
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2043-03-17
AI Technical Summary
During the video encoding process, the high-resolution image needs to be divided into multiple non-overlapping slices and processed in parallel on the encoding and decoding sides, resulting in the need to buffer the bitstream of all slices, occupying a large amount of storage resources, and the decoding side needs to buffer the bitstream for a long time, which cannot meet the delay requirements of low-latency scenarios.
By dividing each slice into multiple blocks and interleaved the blocks within each row of slices on the encoding side, the target bitstream is generated and transmitted to the decoding side. After receiving the target bitstream on the decoding side, it deinterleaves and decodes each slice block, thereby achieving parallel decoding of multiple slices without buffering all bitstreams.
Reduce the storage resource requirements on the decoding side and reduce the decoding delay, so that multi-slicing parallel decoding can be effectively performed in low-latency scenarios.
Smart Images

Figure 2025508232000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to the technical field of encoding and decoding, and in particular to an encoding and decoding method, apparatus and device thereof. [Background technology]
[0002] A video image is encoded before being transmitted, and a complete video encoding method may include processes such as prediction, transformation, quantization, entropy coding, filtering, etc. Predictive encoding may include intra-coding and inter-coding. Inter-coding uses the temporal correlation of video to predict pixels of a current image using pixels of adjacent encoded images to achieve the purpose of removing temporal redundancy in video. Intra-coding takes into account the strong spatial correlation between adjacent blocks in a current image, predicts a block that is not currently encoded using surrounding reconstructed pixels as reference pixels, and performs subsequent encoding processes on residual values instead of encoding original values, effectively removing spatial redundancy.
[0003] For each coding block, a residual signal is generated after the original input signal is predicted, and the temporal and spatial redundancies are removed. Then, the residual signal is transformed to further concentrate the energy of the transformed residual signal. Next, the transformed residual signal is quantized by adjusting the quantization step. For example, a larger quantization step is adopted for high frequency signals, and a smaller quantization step is adopted for low frequency signals. This ensures that the basic information of the image is not lost. Finally, an entropy coding process is performed, which includes encoding the non-binary coding information into binary information, and outputting a binary bit stream after removing the coding redundancy. That is, the binary bit stream after entropy coding is transmitted.
[0004] In the video encoding process, the encoding side needs to divide an image into several non-overlapping slices, encode each slice, and send the bitstream of each slice (i.e., the binary bitstream after entropy encoding) to the decoding side sequentially. In the video decoding process, the decoding side receives the bitstream, and sequentially decodes each slice according to the bitstream to obtain a reconstructed image.
[0005] For high-resolution images, the encoding side needs to encode multiple slices in parallel to improve the throughput of the encoding side, and the decoding side needs to decode multiple slices in parallel to improve the throughput of the decoding side. Therefore, the bitstreams of all slices of the entire image need to be buffered, which requires a large amount of storage resources. In addition, the decoding side needs to buffer the bitstreams of all slices before decoding multiple slices in parallel. That is, it takes a long time to complete the buffering, which cannot meet the delay requirements of low-delay scenarios. Summary of the Invention
[0006] The present invention provides an encoding method, the method comprising the steps of: dividing a target image into X*Y slices, where X represents the number of slices in a horizontal direction of the target image, Y represents the number of slices in a vertical direction of the target image, X is a positive integer greater than 1, and Y is a positive integer equal to or greater than 1; determining a number Z of chunks in each slice, Z representing the number of chunks contained in each slice; For each of Y slice rows corresponding to the image to be processed, encoding X slices in the horizontal direction of the slice row, obtaining X bitstream buffers corresponding to the X slices, dividing the bitstream buffer into Z chunks for each of the X bitstream buffers, interleaving the chunks corresponding to the X slices in the horizontal direction of the slice row to obtain a target bitstream, and transmitting the target bitstream to a decoding side; Here, the Z chunks include chunks of at least two different sizes.
[0007] The present invention provides a method of decoding, the method comprising the steps of: dividing a target image into X*Y slices, where X represents the number of slices in a horizontal direction of the target image, Y represents the number of slices in a vertical direction of the target image, X is a positive integer greater than 1, and Y is a positive integer equal to or greater than 1; determining a number Z of chunks in each slice, Z representing the number of chunks contained in each slice; For each of the Y slice rows corresponding to the processing target image, Deinterleaving chunks corresponding to X slices in a horizontal direction of the slice row in the target bitstream to obtain Z chunks corresponding to each of the X slices; decoding the X slices based on a bitstream buffer corresponding to the X slices in the horizontal direction of the slice row; Here, the Z chunks include chunks of at least two different sizes, and the bitstream buffer corresponding to each slice includes the chunks corresponding to the slice.
[0008] The present invention provides an encoding device, said device comprising a memory configured to store video data and an encoder, said encoder comprising: Dividing a processing target image into X*Y slices, X represents the number of slices in a horizontal direction of the processing target image, Y represents the number of slices in a vertical direction of the processing target image, X is a positive integer greater than 1, and Y is a positive integer equal to or greater than 1; Determine the number of chunks Z in each slice, where Z represents the number of chunks contained within each slice; For each of the Y slice rows corresponding to the target image, encode X slices in the horizontal direction of the slice row to obtain X bitstream buffers corresponding to the X slices; for each of the X bitstream buffers, divide the bitstream buffer into Z chunks, and interleave the chunks corresponding to the X slices in the horizontal direction of the slice row to obtain a target bitstream; configured to transmit the target bitstream to a decoding side; Here, the Z chunks include chunks of at least two different sizes.
[0009] The present invention provides a decoding device, said device comprising a memory configured to store video data and a decoder, said decoder comprising: Dividing a processing target image into X*Y slices, X represents the number of slices in a horizontal direction of the processing target image, Y represents the number of slices in a vertical direction of the processing target image, X is a positive integer greater than 1, and Y is a positive integer equal to or greater than 1; Determine the number of chunks Z in each slice, where Z represents the number of chunks contained within each slice; For each of Y slice rows corresponding to the processing target image, deinterleaving chunks corresponding to X slices in the horizontal direction of the slice row in the target bitstream to obtain Z chunks corresponding to each of the X slices, and decoding the X slices based on a bitstream buffer corresponding to the X slices in the horizontal direction of the slice row; Here, the Z chunks include chunks of at least two different sizes, and the bitstream buffer corresponding to each slice includes the chunks corresponding to the slice.
[0010] The present invention provides an encoding device including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being used to perform the encoding method according to the above embodiment by executing the machine-executable instructions.
[0011] The present invention provides a decoding device including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being used to perform the decoding method according to the above embodiment by executing the machine-executable instructions. Effect of the Invention
[0012] As can be seen from the above technical solution, for each slice, the slice is divided into multiple chunks, and the encoding side interleaves all the chunks into a target bitstream, and sends the target bitstream to the decoding side. Correspondingly, the decoding side deinterleaves the chunks in the target bitstream to obtain the chunks corresponding to each slice, and decodes the chunks. In this way, the decoding side can decode multiple slices in parallel without buffering all the bitstreams, which can save storage resources and meet the delay requirements of low-delay scenarios. [Brief description of the drawings]
[0013] [Figure 1A] FIG. 2 is a schematic diagram of encoding and decoding according to an embodiment of the present invention; [Figure 1B] FIG. 2 is a schematic diagram of encoding and decoding according to an embodiment of the present invention; [Figure 1C-1] FIG. 2 is a schematic diagram of encoding and decoding according to an embodiment of the present invention; [Figure 1C-2]FIG. 2 is a schematic diagram of encoding and decoding according to an embodiment of the present invention; [Figure 1C-3] FIG. 2 is a schematic diagram of encoding and decoding according to an embodiment of the present invention; [Figure 1D] FIG. 2 is a schematic diagram of encoding and decoding according to an embodiment of the present invention; [Figure 1E] FIG. 2 is a schematic diagram of encoding and decoding according to an embodiment of the present invention; [Figure 1F] FIG. 2 is a schematic diagram of encoding and decoding according to an embodiment of the present invention; [Figure 2A] 4 is a flowchart of an encoding method and a decoding method according to an embodiment of the present invention. [Figure 2B] 4 is a flowchart of an encoding method and a decoding method according to an embodiment of the present invention. [Figure 3A] FIG. 2 is a schematic diagram of a slice according to an embodiment of the present invention. [Figure 3B] FIG. 2 is a schematic diagram of a slice according to an embodiment of the present invention. [Figure 4A] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 4B] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 4C] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 4D] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 5A] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 5B] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 5C] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 6A] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 6B] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 6C] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 7A] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 7B] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 8A] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 8B] FIG. 2 is a schematic diagram of chunk sizes according to one embodiment of the present invention. [Figure 9A] 2 is a hardware structural diagram of a decoding device according to an embodiment of the present invention; [Figure 9B] FIG. 2 is a hardware structural diagram of an encoding device according to an embodiment of the present invention; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0014] The terms used in the embodiments of the present invention are not intended to limit the present invention, but merely to describe a particular embodiment. The singular forms "a," "the," and "said" used in the embodiments and claims of the present invention are intended to include the plural, unless the context clearly indicates otherwise. The term "and / or" as used herein should be understood to mean any or all possible combinations including one or more of the associated listed items. Although the embodiments of the present invention may use terms such as first, second, and third to describe various information, it should be understood that such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, the first information may be referred to as the second information, and similarly, the second information may be referred to as the first information, without departing from the scope of the present invention. Depending on the context, the word "if" used may further be interpreted as "when...", or "when...", or "in response to determining...".
[0015] In order to enable those skilled in the art to better understand the technical solution of the present invention, technical terms are briefly explained below.
[0016] image_width: A 16-bit unsigned integer that represents the width of the luminance component of the image, i.e. the number of samples in the horizontal direction. The units of image_width are the number of samples per image row, such that the sample in the top-left corner of the visible area is aligned with the sample in the top-left corner of the image. The value of image_width is a non-zero integer multiple of 16.
[0017] Image height (image_height): A 16-bit unsigned integer that represents the height of the luminance component of the image, i.e., the number of vertical scan lines. The unit of image_height is the number of lines of image samples, and the value of image_height can be a non-zero integer multiple of 2.
[0018] Image real width (real_width) and image real height (real_height): The relationship between real_width and real_height and the image boundary is shown in Figure 1A. The solid line indicates the boundary of the visible area of the image, and the width and height of the visible area boundary are determined by real_width and real_height, respectively. The dashed line indicates the image boundary, and the width and height of the image boundary are determined by image_width and image_height, respectively. In the following embodiments, image_width and image_height will be used as examples.
[0019] Slice: a fixed rectangular region in an image, which may include multiple coding units. Slices do not overlap each other. As shown in FIG. 1B, taking slice A, slice B, slice C, slice D, slice E, slice F, slice G, slice H and slice I as examples, each slice may include multiple coding units. FIG. 1C-1 to FIG. 1C-3 show the structural relationship of three types of slices, FIG. 1C-1 shows the structural relationship of four slices, FIG. 1C-2 shows the structural relationship of two slices, and FIG. 1C-3 shows the structural relationship of eight slices.
[0020] Slice width (slice_width) and slice height (slice_height): parameters set by the encoding side, which respectively indicate the width and height of a slice. In units of coding units (CUs), SliceNumX indicates the number of slices in the horizontal direction of an image, and SliceNumY indicates the number of slices in the vertical direction of an image. The distribution relationship between slices, slice width, and slice height are shown in Figure 1D.
[0021] Illustratively, SliceNumX and SliceNumY are calculated as follows: SliceNumX=(image_width+slice_width-1) / slice_width, SliceNumY=(image_height+slice_height-1) / slice_height
[0022] Bits per pixel (bpp): This refers to the average number of bits required to represent each pixel. For example, for an original image in 10-bit YUV444 format, bpp is 30.
[0023] Target bits per pixel (target bpp): a parameter specified by the encoding side that represents the average number of bits needed to represent each pixel after compression. For example, for an original image in 10-bit YUV444 format, the target bpp is 5. Obviously, a bpp of 30 means 6 times compression.
[0024] The video coding framework applied in the present invention can realize the process flow of the coding side of the embodiment of the present invention, as shown in FIG. 1E. The schematic diagram of the video decoding framework is similar to FIG. 1E, and the description is omitted here. The video decoding framework can realize the process flow of the decoding side of the embodiment of the present invention. The video coding framework and the video decoding framework may include modules such as intra prediction, motion estimation / motion compensation, reference image buffer, in-loop filter, reconstruction, transform, quantization, inverse transform, inverse quantization, and entropy coder, but are not limited thereto. On the coding side, the process flow of the coding side can be realized by the cooperation between these modules. On the decoding side, the process flow of the decoding side can be realized by the cooperation between these modules.
[0025] For example, prediction is divided into intra prediction and inter prediction. Intra prediction uses surrounding reconstructed pixels as reference pixels to predict a block that is not currently encoded, taking into account the very strong spatial correlation between adjacent blocks in an image, and instead of encoding the original signal, subsequent encoding processing can be performed only on the residual signal (original signal-predicted signal), thereby effectively removing spatial redundancy. Inter prediction utilizes the temporal correlation of a video signal to predict pixels of a current image using pixels of adjacent encoded images, thereby achieving the purpose of removing temporal redundancy in video.
[0026] For example, in the video coding process, transforming means converting an image described in pixel format in the spatial domain into an image in the transform domain and expressing it in the form of transform coefficients. Since most images contain many flat and slowly changing regions, a suitable transform can transform the dispersed distribution of image energy in the spatial domain into a relatively concentrated distribution in the transform domain, and can eliminate the frequency domain correlation between signals. In this way, the transform process can effectively compress the bitstream in line with the quantization process.
[0027] Illustratively, entropy coding refers to lossless coding according to the principle of information entropy, and is the final processing module of video coding compression, which converts a series of element symbols for representing a video sequence into one binary bit stream for transmission or storage. The element symbols input to the entropy coding module may include quantized transform coefficients, motion vector information, prediction mode information, transform quantization correlation syntax, etc. The output data of the entropy coding module is the final bit stream after the original video is compressed. Entropy coding can effectively remove the statistical redundancy of these element symbols, and is one of the important tools for ensuring the efficiency of video coding compression.
[0028] As shown in FIG. 1F, in the video coding process, the coding of each image block (i.e., coding block) generally includes prediction, transformation, quantization, entropy coding, etc. For each coding block, a residual signal is generated after the original input signal is predicted, and the time and spatial redundancy is removed. Then, the energy of the residual signal is further concentrated by transformation. Then, quantization is performed by adjusting the quantization step (including adopting a larger quantization step for high frequency signals and a smaller quantization step for low frequency signals). This ensures that the basic information of the image is not lost, and finally, the non-binary coding information is coded into binary information by entropy coding, and a binary bit stream is output after the coding redundancy is removed.
[0029] In the video encoding process, an image is divided into several non-overlapping rectangular slices, each slice contains an integer number of non-overlapping coding blocks, and each slice is coded independently in sequence (the coding process is, as shown in FIG. 1F, through modules such as prediction, transformation, quantization, entropy coding, etc., to generate a binary bitstream), and then the bitstreams of each slice are sequentially concatenated to form a final bitstream, and the final bitstream is sent to the decoding side. Corresponding to the coding side, in the video decoding process, an image is first divided into several rectangular slices that correspond to the coding side, and the decoding side receives the bitstream, sequentially decodes each slice (the decoding of each coding block in each slice includes processes such as entropy decoding, inverse quantization, inverse transformation, prediction, etc.), obtains the reconstructed pixels of each rectangular slice, and concatenates the reconstructed pixels of each slice to obtain a reconstructed image.
[0030] For high-resolution images, the encoding side needs to code multiple slices in parallel to improve the throughput of the encoding side, and the decoding side needs to decode multiple slices in parallel to improve the throughput of the decoding side. To achieve this goal, the bitstreams of all slices of the entire image need to be buffered, which requires a large amount of storage resources. In addition, the decoding side needs a long time to buffer the bitstreams of all slices, which cannot meet the delay requirements of low-delay scenarios.
[0031] In response to the above findings, a bitstream grouping method is designed in an embodiment of the present invention. Specifically, the encoding side divides each slice into multiple chunks, each chunk being composed of a multi-byte bitstream, and then performs bitstream interleaving encoding on the chunks of each slice in one slice row. In this way, parallel decoding can be realized by only buffering some chunks, and the decoding delay can be greatly reduced and the buffer size of the bitstream on the decoding side can be reduced. For example, for each slice, the slice can be divided into multiple chunks, and the encoding side can interleave all the chunks into a target bitstream and send the target bitstream to the decoding side. Correspondingly, the decoding side deinterleaves the chunks in the target bitstream to obtain the chunks corresponding to each slice, and decodes the chunks. In this way, the decoding side can decode multiple slices in parallel without buffering all the bitstreams, saving storage resources and enabling parallel decoding even in low-delay scenarios.
[0032] The encoding method and the decoding method according to the embodiments of the present invention will be described in detail below with reference to some specific examples. Example 1:
[0033] As shown in Figure 2A, Figure 2A is a flowchart of an encoding method according to an embodiment of the present invention. The method may be applied to an encoding side (for example, a video encoder) and may include the following steps:
[0034] In step 211, the image to be processed is divided into X*Y slices. Here, X represents the number of slices in the horizontal direction of the image, hereinafter referred to as SliceNumX. Y represents the number of slices in the vertical direction of the image, hereinafter referred to as SliceNumY. X may be a positive integer greater than 1, and Y may be a positive integer equal to or greater than 1. Exemplarily, as shown in FIG. 1B, X is 3 and Y is 3. As shown in FIG. 1C-1, X is 2 and Y is 2. As shown in FIG. 1C-2, X is 2 and Y is 1. As shown in FIG. 1C-3, X is 4 and Y is 2.
[0035] In step 212, the number of chunks Z in each slice is determined, where Z represents the number of chunks in the same slice, which may hereafter be referred to as ChunkNum.
[0036] In one possible embodiment, the number of chunks in each slice may be determined based on a target number of transmission bits (also called total resources), for example, the target number of transmission bits may be determined based on the slice width, slice height, and target bits per pixel, and the number of chunks may be determined based on the target number of transmission bits and a configured chunk size value.
[0037] The target number of transmission bits is the sum of the number of occupied bits of all pixels in one slice. For example, the total number of pixels in a slice may be determined based on the slice width and slice height, and the target number of transmission bits may be determined based on the total number of pixels and the target bits per pixel.
[0038] The set chunk size value is used to indicate the length of a chunk, and may be a value preset based on experience, or may be a value indicated by a syntax parameter (e.g., a picture level syntax parameter, a sequence level syntax parameter, etc.), but is not limited thereto. Obviously, the target transmission bit number indicates the length of all chunks, and the chunk size value indicates the length of one chunk, so that the number of chunks can be determined based on the target transmission bit number and the chunk size value.
[0039] In another possible embodiment, the number of chunks may be determined based on the slice height. For example, if the size of the slice is slice_width*slice_height (i.e., there are slice_width*slice_height pixels in total, each row has slice_width pixels, and there are slice_height slice rows in total), and the length of the chunk is determined based on slice_width, the number of chunks may be determined based on slice_height. For example, if the length of the chunk is slice_width, the number of chunks may be slice_height, if the length of the chunk is slice_width / 2, the number of chunks may be 2*slice_height, and if the length of the chunk is 2*slice_width, the number of chunks may be slice_height / 2. Of course, the above is merely an example and is not limited in the present invention.
[0040] In step 213, for Y slice rows corresponding to the target image, X slices in the horizontal direction of the same slice row are coded to obtain X corresponding bitstream buffers. Since the processing process of each slice row is the same, the processing process of one slice row is taken as an example below.
[0041] For example, X slices in the slice row may be encoded to obtain X corresponding bitstream buffers. As shown in FIG. 1B, the first slice row is encoded first, that is, for example, slice A, slice B, and slice C are encoded in parallel to obtain a bitstream buffer A1 corresponding to slice A, a bitstream buffer B1 corresponding to slice B, and a bitstream buffer C1 corresponding to slice C.
[0042] After the encoding of the first slice row is completed, encoding is performed on the second slice row, i.e., encoding slices D, E, and F, for example, encoding slices D, E, and F in parallel to obtain a bitstream buffer D1 corresponding to slice D, a bitstream buffer E1 corresponding to slice E, and a bitstream buffer F1 corresponding to slice F.
[0043] After the encoding of the second slice row is completed, encoding is performed on the third slice row, i.e., encoding slice G, slice H, and slice I, for example, encoding slice G, slice H, and slice I in parallel to obtain a bitstream buffer G1 corresponding to slice G, a bitstream buffer H1 corresponding to slice H, and a bitstream buffer I1 corresponding to slice I.
[0044] In step 214, for each bitstream buffer, divide the bitstream buffer into Z chunks, where the Z chunks include chunks of at least two different sizes.
[0045] Illustratively, for chunks that have two sizes, the size may be the length of the chunk.
[0046] For example, after the encoding of the first slice row is completed, we can obtain a bitstream buffer A1 corresponding to slice A, a bitstream buffer B1 corresponding to slice B, and a bitstream buffer C1 corresponding to slice C. Based on this, the bitstream buffer A1 may be divided into Z chunks denoted as chunk A11, chunk A12, ..., the bitstream buffer B1 may be divided into Z chunks denoted as chunk B11, chunk B12, ..., and the bitstream buffer C1 may be divided into Z chunks denoted as chunk C11, chunk C12, ....
[0047] Among the Z chunks corresponding to bitstream buffer A1, there are at least two different sizes of chunks, among the Z chunks corresponding to bitstream buffer B1, there are at least two different sizes of chunks, and among the Z chunks corresponding to bitstream buffer C1, there are at least two different sizes of chunks.
[0048] In step 215, chunks corresponding to X slices in the horizontal direction of the same slice row are interleaved to obtain a target bitstream.
[0049] For example, first, add chunk A11 corresponding to slice A to the current bitstream, then add chunk B11 corresponding to slice B to the current bitstream, then add chunk C11 corresponding to slice C to the current bitstream, then add chunk A12 corresponding to slice A to the current bitstream, then add chunk B12 corresponding to slice B to the current bitstream, then add chunk C12 corresponding to slice C to the current bitstream, and so on to finally obtain a target bitstream. Obviously, in the target bitstream, a chunk corresponding to a slice is connected with a chunk corresponding to another slice, not with other chunks corresponding to the slice. That is, the target bitstream is formed by interleaving chunks corresponding to different slices.
[0050] Obviously, in a target bitstream, before the last chunk of one slice is added to the target bitstream, the chunk of another slice needs to be added to the target bitstream, e.g., before the last chunk of slice A is added to the target bitstream, the chunk of slice B needs to be added to the target bitstream, and before the last chunk of slice B is added to the target bitstream, the chunk of slice A needs to be added to the target bitstream.
[0051] In one possible embodiment, according to the order of X slices in the horizontal direction of the same slice row, one chunk (in actual application, it may be at least two chunks, but the present invention is not limited to this, but in this embodiment, one chunk is taken as an example) corresponding to each of the X slices in the slice row is added to the current bitstream in sequence, and it is determined whether all chunks have been added to the current bitstream. If all chunks have been added to the current bitstream, stop adding chunks, and make the current bitstream the target bitstream. If not, return to the operation of adding one chunk corresponding to each of the X slices to the current bitstream in sequence according to the order of X slices in the horizontal direction of the slice row.
[0052] For example, for slices A, B, and C sequentially arranged in the horizontal direction, one chunk A11 corresponding to slice A, one chunk B11 corresponding to slice B, and one chunk C11 corresponding to slice C may be sequentially added to the current bitstream, and it may be determined whether all chunks of slices A, B, and C have been added to the current bitstream. If so, stop adding chunks, i.e., complete the processing of the current slice row, and obtain the current bitstream of the current slice row as the target bitstream.
[0053] If not, continue adding one chunk corresponding to slice A, one chunk corresponding to slice B, and one chunk corresponding to slice C to the current bitstream, and determine whether all chunks have been added to the current bitstream. This process is repeated until all chunks have been added to the current bitstream, thus completing the processing of the current slice row and obtaining the target bitstream.
[0054] In one possible embodiment, when chunks corresponding to X slices are obtained, start interleaving the chunks corresponding to X slices to obtain a target bitstream, where the chunks corresponding to X slices are obtained including that, for each slice, S chunks corresponding to the slice are obtained, where S is greater than or equal to 1 and S is less than the number of chunks.
[0055] For example, after the encoding of the first slice row is completed, obtain the bitstream buffer A1 corresponding to slice A, the bitstream buffer B1 corresponding to slice B, and the bitstream buffer C1 corresponding to slice C, and divide chunk A11 from bitstream buffer A1, divide chunk B11 from bitstream buffer B1, and divide chunk C11 from bitstream buffer C1. Next, divide chunk A12 from bitstream buffer A1, divide chunk B12 from bitstream buffer B1, and divide chunk C12 from bitstream buffer C1. Then, divide chunk A13 from bitstream buffer A1, divide chunk B13 from bitstream buffer B1, and divide chunk C13 from bitstream buffer C1, and so on.
[0056] Based on this, when chunk A11, chunk B11, and chunk C11 are obtained, interleaving of these chunks may be started to obtain a target bitstream. Or, when chunk A11, chunk B11, chunk C11, chunk A12, chunk B12, and chunk C12 are obtained, interleaving of these chunks may be started to obtain a target bitstream. Or, when chunk A11, chunk B11, chunk C11, chunk A12, chunk B12, chunk C12, chunk A13, chunk B13, and chunk C13 are obtained, interleaving of these chunks may be started to obtain a target bitstream. Obviously, when S chunks corresponding to each slice are obtained, interleaving of chunks corresponding to X slices may be started to obtain a target bitstream, where S is equal to or greater than 1 and is less than the number of chunks.
[0057] In step 216, the target bitstream is sent to the decoding side, where the target bitstream includes chunks of X slices in the horizontal direction.
[0058] 2B is a flowchart of a decoding method according to another embodiment of the present invention. The method may be applied to a decoding side (eg, a video decoder) and may include the following steps:
[0059] In step 221, the image to be processed is divided into X*Y slices, where X represents the number of slices in the horizontal direction of the image, hereinafter referred to as SliceNumX, and Y represents the number of slices in the vertical direction of the image, hereinafter referred to as SliceNumY. X may be a positive integer greater than 1, and Y may be a positive integer equal to or greater than 1. In other words, they may match the parameters on the encoding side.
[0060] In step 222, the number of chunks Z in each slice is determined.
[0061] In one possible embodiment, the number of chunks in each slice may be determined based on a target number of transmission bits (also called total resources), for example, the target number of transmission bits may be determined based on the slice width, slice height, and target bits per pixel, and the number of chunks may be determined based on the target number of transmission bits and a configured chunk size value.
[0062] In another possible embodiment, the number of chunks may be determined based on the slice height.
[0063] For example, steps 221 and 222 can refer to steps 211 and 212, and the description thereof will be omitted here.
[0064] In step 223, for the Y slice rows corresponding to the processing target image, chunks corresponding to X slices in the horizontal direction of the same slice row in the target bit stream are deinterleaved to obtain Z chunks corresponding to each slice. Here, the Z chunks include chunks of at least two sizes. For example, the decoding side can receive a target bit stream including chunks of X slices in the horizontal direction of the same slice row from the encoding side, so that the decoding side can deinterleave chunks corresponding to X slices in the horizontal direction of the same slice row in the target bit stream to obtain Z chunks corresponding to each slice. Since the processing process of each slice row is the same, the processing process of one slice row is taken as an example below.
[0065] As an example, assume that the X slices in one slice row are slice A, slice B, and slice C, first parse chunk A11 corresponding to slice A from the target bitstream, then parse chunk B11 corresponding to slice B from the target bitstream, then parse chunk C11 corresponding to slice C from the target bitstream, then parse chunk A12 corresponding to slice A from the target bitstream, then parse chunk B12 corresponding to slice B from the target bitstream, and then parse chunk C12 corresponding to slice C from the target bitstream, and so on to finally obtain Z chunks corresponding to each slice.
[0066] Obviously, before parsing the last chunk of one slice from the target bitstream, one needs to parse the chunk of another slice from the target bitstream, e.g., before parsing the last chunk of slice A, one needs to parse the chunk of slice B, and before parsing the last chunk of slice B, one needs to parse the chunk of slice A.
[0067] In one possible embodiment, according to the order of X slices in the horizontal direction of the same slice row, one chunk (in actual application, it may be at least two chunks, but the present invention is not limited to this, but in this embodiment, one chunk is taken as an example) corresponding to each slice is sequentially parsed into the bitstream buffer corresponding to the slice, and judge whether all chunks are parsed. If it is judged that all chunks of X slices are parsed, complete the deinterleaving of X slices, and obtain all Z chunks corresponding to each slice. If it is judged that all chunks of X slices are not parsed, return to the operation of sequentially parsing one chunk corresponding to each slice into the bitstream buffer corresponding to the slice according to the order of X slices in the horizontal direction of the same slice row.
[0068] For example, for slices A, B, and C arranged in sequence in the horizontal direction, parse one chunk A11 corresponding to slice A into the bitstream buffer A1 corresponding to slice A, parse one chunk B11 corresponding to slice B into the bitstream buffer B1 corresponding to slice B, and parse one chunk C11 corresponding to slice C into the bitstream buffer C1 corresponding to slice C, and determine whether all chunks of slices A, B, and C have been parsed. If all chunks have been parsed, the deinterleaving of X slices is completed, and all Z chunks corresponding to each slice are obtained. If all chunks have not been parsed, continue to parse one chunk corresponding to slice A into the bitstream buffer A1, parse one chunk corresponding to slice B into the bitstream buffer B1, and parse one chunk corresponding to slice C into the bitstream buffer C1, and this process is repeated until all chunks have been parsed, thus completing the deinterleaving of X slices and obtaining all Z chunks corresponding to each slice.
[0069] As a result of the above, Z chunks corresponding to slice A can be obtained, where the Z chunks have at least two different sizes, Z chunks corresponding to slice B can be obtained, where the Z chunks have at least two different sizes, and Z chunks corresponding to slice C can be obtained, where the Z chunks have at least two different sizes.
[0070] In step 224, for Y slice rows corresponding to the target image, X slices are decoded based on bitstream buffers corresponding to X slices in the horizontal direction of the same slice row, where the bitstream buffer corresponding to each slice includes a chunk corresponding to the slice, for example, at least one chunk.
[0071] For example, the bitstream buffer A1 corresponding to slice A may include chunks A11, A12, A13, ... corresponding to slice A, the bitstream buffer B1 corresponding to slice B may include chunks B11, B12, B13, ... corresponding to slice B, and the bitstream buffer C1 corresponding to slice C may include chunks C11, C12, C13, ... corresponding to slice C. Based on this, chunks A11, B11, and C11 may be decoded, for example, in parallel, and there is no restriction on this decoding process. Then, chunks A12, B12, and C12 may be decoded, for example, in parallel. After that, chunks A13, B13, and C13 may be decoded, for example, in parallel, and in this manner, the decoding process of all chunks of X slices in the horizontal direction is repeated until completion.
[0072] In one possible embodiment, start decoding chunks corresponding to X slices if chunks corresponding to X slices exist in the bitstream buffer corresponding to X slices, where the existence of chunks corresponding to X slices in the bitstream buffer corresponding to X slices may include, but is not limited to, for each slice, T chunks corresponding to the slice exist in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and T is less than the number of chunks.
[0073] Obviously, when there are T chunks in the bitstream buffer, X slices may be decoded based on the bitstream buffer corresponding to X slices in the horizontal direction before deinterleaving the last group of chunks to start decoding the chunks corresponding to X slices. In practical application, X slices may be decoded based on the bitstream buffer corresponding to X slices in the horizontal direction after deinterleaving the last group of chunks.
[0074] For example, the decoding side first parses chunk A11, chunk B11, and chunk C11 from the target bitstream, buffers chunk A11 in bitstream buffer A1, buffers chunk B11 in bitstream buffer B1, and buffers chunk C11 in bitstream buffer C1. Then, parses chunk A12, chunk B12, and chunk C12 from the target bitstream, buffers chunk A12 in bitstream buffer A1, buffers chunk B12 in bitstream buffer B1, and buffers chunk C12 in bitstream buffer C1. Then, parses chunk A13, chunk B13, and chunk C13 from the target bitstream, buffers chunk A13 in bitstream buffer A1, buffers chunk B13 in bitstream buffer B1, and buffers chunk C13 in bitstream buffer C1, and so on.
[0075] For example, the size of a plurality of chunks that the encoding side interleaves each time is the same, and the size of a plurality of chunks that the decoding side deinterleaves each time is the same. For example, the size of chunk A11, chunk B11, and chunk C11 is the same, and the size of chunk A12, chunk B12, and chunk C12 is also the same. However, the size of chunk A11 may be the same as the size of chunk A12, or may be different. For the dimensional relationship of different chunks, please refer to the following embodiment.
[0076] Based on this, if chunk A11, chunk B11, and chunk C11 exist in these bitstream buffers, these chunks may be decoded. Or, if chunk A11, chunk B11, chunk C11, chunk A12, chunk B12, and chunk C12 exist in these bitstream buffers, these chunks may be decoded. Or, if chunk A11, chunk B11, chunk C11, chunk A12, chunk B12, chunk C12, chunk A13, chunk B13, and chunk C13 exist in these bitstream buffers, these chunks may be decoded. Obviously, if there are T chunks in the bitstream buffers corresponding to each slice, X slices may be decoded based on the bitstream buffers corresponding to X slices in the horizontal direction. T is equal to or greater than 1, and T is less than the number of chunks.
[0077] In one possible embodiment, the chunks of at least two sizes may be of the following several cases:
[0078] Case 1: When the number of actual coding bits is constant, for Z chunks, the lengths of the remaining chunks other than the k-th chunk are all the first size, and the length of the k-th chunk is the second size.
[0079] At the encoding side and the decoding side, the first size is determined based on a set chunk size value, and the second size is determined based on a target number of transmission bits, the chunk size value, and the number of chunks.
[0080] Case 2: When the number of actual encoding bits is constant, for Z chunks, the lengths of the remaining chunks other than the k-th chunk are all the first size, and the length of the k-th chunk is the second size.
[0081] At the encoding and decoding sides, the first size is determined based on the slice width and bits per pixel, and the second size is determined based on the target number of transmission bits, the first size, and the number of chunks.
[0082] Case 3: When the number of actual coding bits is constant, for Z chunks, the chunk set includes the remaining chunks other than the k-th chunk, all odd-numbered chunks in the chunk set have lengths of a first size, all even-numbered chunks have lengths of a second size, and the k-th chunk has a third size.
[0083] At the encoding side and the decoding side, the first size is determined based on the sum of the chunk size value and a preset value, the second size is determined based on the difference between the chunk size value and the preset value, and the third size is determined based on the target number of transmission bits, the chunk size value, and the number of chunks.
[0084] In case 4, when the number of actual coding bits is constant, for Z chunks, the chunk set includes the remaining chunks other than the kth chunk, and the lengths of all odd-numbered chunks in the chunk set are a first size, the lengths of all even-numbered chunks are a second size, and the length of the kth chunk is a third size.
[0085] At the encoding side and the decoding side, the first size is determined based on the sum of the number of pixels in the slice row and a preset value, the second size is determined based on the difference between the number of pixels in the slice row and the preset value, and the third size is determined based on the target transmission bit number, the number of pixels in the slice row, and the number of chunks. The number of pixels in the slice row may be determined based on the slice width and bits per pixel.
[0086] Case 5: When the number of actual coding bits is constant, for Z chunks, all odd-numbered chunks have a length of the first size, and all even-numbered chunks have a length of the second size.
[0087] At the encoding side and the decoding side, the first size is determined based on the sum of the set chunk size value and a preset value, and the second size is determined based on the difference between the chunk size value and the preset value.
[0088] Case 6: When the number of actual coding bits is constant, for Z chunks, all odd-numbered chunks have a length of the first size, and all even-numbered chunks have a length of the second size.
[0089] At the encoding side and the decoding side, the first size is determined based on the sum of the number of pixels in the slice row and a preset value, and the second size is determined based on the difference between the number of pixels in the slice row and the preset value. The number of pixels in the slice row is determined based on the slice width and the bits per pixel.
[0090] Case 7: When the actual number of encoded bits is not constant, for Z chunks, the lengths of the remaining chunks other than the k-th chunk are all the first size, and the length of the k-th chunk is the second size.
[0091] At the encoding side, the first size is determined based on a set chunk size value, and the second size is determined based on the actual number of encoded bits in the bitstream buffer, the chunk size value, and the number of chunks. When the encoding side sends the target bitstream to the decoding side, the target bitstream may further include chunk length indication information to indicate the second size.
[0092] At the decoding side, the first size is determined based on a set chunk size value, and the second size is determined based on a chunk length indicator. For example, the target bitstream may include chunk length indicator for indicating the second size, and the decoding side may parse the chunk length indicator from the target bitstream and determine the second size based on the slice length indicator.
[0093] Case 8: When the actual number of encoded bits is not constant, for Z chunks, the lengths of the remaining chunks other than the k-th chunk are all the first size, and the length of the k-th chunk is the second size.
[0094] At the encoding side, the first size is determined based on the slice width and the bits per pixel, and the second size is determined based on the actual number of encoded bits in the bitstream buffer, the first size, and the number of chunks. When the encoding side sends the target bitstream to the decoding side, the target bitstream may further include chunk length indication information to indicate the second size.
[0095] At the decoding side, the first size is determined based on the slice width and bits per pixel, and the second size is determined based on chunk length indication information included in the target bitstream. For example, the decoding side may analyze chunk length indication information for indicating the second size from the target bitstream, and determine the second size based on the chunk length indication information.
[0096] Case 9: When the number of actual coding bits is constant, for Z chunks, the lengths of the remaining chunks other than the k-th chunk are all the first size, and the length of the k-th chunk is the second size.
[0097] At the encoding side, the first size is determined based on a set chunk size value, and the second size is determined based on a target transmission bit number, the chunk size value, and the number of chunks. When the encoding side sends a target bitstream to the decoding side, the target bitstream may further include chunk length indication information for indicating the second size.
[0098] On the decoding side, the first size is determined based on a set chunk size value, and the second size is determined based on chunk length indication information included in the target bitstream. For example, the decoding side may analyze chunk length indication information for indicating the second size from the target bitstream, and determine the second size based on the chunk length indication information.
[0099] Case 10: When the number of actual encoding bits is constant, for Z chunks, the lengths of the remaining chunks other than the k-th chunk are all the first size, and the length of the k-th chunk is the second size.
[0100] At the encoding side, the first size is determined based on the slice width and the bits per pixel, and the second size is determined based on the target transmission bit number, the first size, and the number of chunks. When the encoding side sends the target bitstream to the decoding side, the target bitstream may further include chunk length indication information for indicating the second size.
[0101] At the decoding side, the first size is determined based on the slice width and the bits per pixel, and the second size is determined based on the chunk length indication information included in the target bitstream. For example, the decoding side may analyze the chunk length indication information for indicating the second size from the target bitstream, and determine the second size based on the chunk length indication information.
[0102] In the above cases 1 to 4 and 7 to 10, the k-th chunk may be the last chunk in all chunks, may be the first chunk in all chunks, or may be any chunk between the first chunk and the last chunk in all chunks. Also, the k-th in different cases is irrelevant, and here, the k-th is used to represent the number of the chunk in the set of chunks.
[0103] In the above cases 1 to 10, the first size may be different and is used to represent the length of the chunk. In other words, the first size in case 1 and case 2 may be the same or different. Similarly, the second size may be different and is used to represent the length of the chunk.
[0104] In one possible embodiment, for the encoding and decoding sides, the number of chunks in every slice is the same, thereby ensuring parallel decoding.
[0105] As can be seen from the above technical solution, in the embodiment of the present invention, for each slice, the slice is divided into multiple chunks, and the encoding side interleaves all the chunks into a target bitstream, and sends the target bitstream to the decoding side. Correspondingly, the decoding side deinterleaves the chunks in the target bitstream, obtains the chunks corresponding to each slice, and decodes the chunks. In this way, the decoding side can decode multiple slices in parallel without buffering all the bitstreams, which can save storage resources and meet the delay requirements of low-delay scenarios.
[0106] For example, chunk interleaving on the encoding side includes a process in which the encoding side first adds chunk A1 of slice A to the target bitstream, then adds chunk B1 of slice B to the target bitstream, then adds chunk A2 of slice A to the target bitstream, then adds chunk B2 of slice B to the target bitstream, etc. Correspondingly, chunk deinterleaving on the decoding side includes a process in which the decoding side deinterleaves chunk A1 and chunk B1 from the target bitstream, buffers chunk A1 into the bitstream buffer of slice A, buffers chunk B1 into the bitstream buffer of slice B, deinterleaves chunk A2 and chunk B2 from the target bitstream, buffers chunk A2 into the bitstream buffer of slice A, and buffers chunk B2 into the bitstream buffer of slice B, etc. In this way, after chunk A1 and chunk B1 are buffered in their respective bitstream buffers, chunk A1 and chunk B1 can be decoded in parallel without waiting for subsequent chunk A2 and chunk B2 to also be buffered in their respective bitstream buffers, thereby reducing latency and meeting the delay requirements of low-latency scenarios. After chunk A1 and chunk B1 are decoded in parallel, chunk A1 and chunk B1 can be removed from their respective bitstream buffers, thereby saving storage resources. Example 2:
[0107] In an embodiment of the present invention, an encoding method applicable to an encoding side is provided, and the encoding method may include the following steps.
[0108] In step 1, the image is divided horizontally and vertically into rectangular slices.
[0109] In step 2, the total resource (ie, the target number of transmission bits) is calculated, and the number of chunks, ChunkNum, is determined based on the total resource.
[0110] In step 3, multiple slices in each slice row are coded sequentially to obtain multiple bitstream buffers.
[0111] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0112] Illustratively, there are at least two different sizes of chunks among the ChunkNum chunks.
[0113] In step 5, all slices in one slice row are sequentially coded ChunkNum times, and one chunk of each slice in every slice is interleaved each time to form a bitstream. Since there are ChunkNum chunks in each slice, coding ChunkNum times allows all chunks of each slice to be interleaved to form a bitstream.
[0114] In one possible embodiment, when chunks corresponding to all SliceNumX slices in one slice row are obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream. Obtaining chunks corresponding to all SliceNumX slices may include, for each slice, obtaining S chunks corresponding to the slice, where S is equal to or greater than 1 and is less than the number of chunks.
[0115] In step 6, it is determined whether the encoding of all slice rows has been completed. If not, return to step 3 and encode the next slice row. If not, the encoding process of the current image is completed and the next image may be encoded.
[0116] In an embodiment of the present invention, a decoding method applicable to a decoding side is provided, and the encoding method may include the following steps.
[0117] In step 1, the image is divided horizontally and vertically into rectangular slices.
[0118] In step 2, the total resource (ie, the target number of transmission bits) is calculated, and the number of chunks, ChunkNum, is determined based on the total resource.
[0119] In step 3, receive the bitstream, and parse SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0120] Exemplarily, SliceNumX indicates the number of slices in the horizontal direction of the image.
[0121] For example, since there are ChunkNum chunks in each slice, by analyzing one chunk of the slice and analyzing it ChunkNum times, it is possible to analyze ChunkNum chunks of the slice, i.e., to obtain all chunks of the slice.
[0122] For example, the ChunkNum chunks of the slice include chunks of at least two different sizes.
[0123] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0124] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0125] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0126] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed.
[0127] In one possible embodiment, the encoding side may divide the bitstream buffer of each slice into multiple chunks, and interleave the chunks of all slices in one slice row. At the encoding side and the decoding side, the number of chunks in all slices is the same, which can ensure parallel decoding. The size of the chunks may not be constant. For example, the size of the previous ChunkNum-1 chunks is a set chunk size value such as 8192, and the size of the last chunk is the number of remaining bits. At the encoding side, zero padding and byte alignment may be performed for each slice, so that the size of the chunks of each slice is consistent.
[0128] Taking an example of including two slices in one slice row, i.e., SliceNumX is 2, the bitstream buffer (also called codestream buffer) of slice 1 may be divided into ChunkNum chunks, and the bitstream buffer of slice 2 may be divided into ChunkNum chunks, as shown in FIG. 3A.
[0129] As another example, assuming that a slice row contains three slices, i.e., SliceNumX is 3, the bitstream buffer of slice 1 may be divided into ChunkNum chunks, the bitstream buffer of slice 2 may be divided into ChunkNum chunks, and the bitstream buffer of slice 3 may be divided into ChunkNum chunks, as shown in FIG. 3B. Example 3:
[0130] The actual number of coding bits of each slice is constant, e.g., the actual number of coding bits of each slice is equal to the target number of transmission bits, the length of the previous ChunkNum-1 chunks is constant and is a first size, and the length of the last chunk is not constant and is a second size.
[0131] In the third embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0132] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0133] In step 2, calculate the total resource (i.e., the target transmission bit number, which can be written as total_resource), and determine the number of chunks ChunkNum according to the total resource. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0134] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0135] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0136] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0137] For example, the calculation method of the length of the ChunkNum chunks may refer to the related description for the decoding side in this embodiment below, and the description will be omitted here.
[0138] In step 5, the SliceNumX slices in one slice row are sequentially coded ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0139] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0140] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0141] Exemplarily, a schematic diagram of chunk interleaving when SliceNumX is 2 is shown in FIG. 4A, taking ChunkNum chunks as an example of N chunks, first encode chunk 1 of the first slice, then encode chunk 1 of the second slice, then encode chunk 2 of the first slice, then encode chunk 2 of the second slice, and so on until chunk N of the first slice is encoded, and then chunk N of the second slice is encoded. As shown in FIG. 4B, the lengths of chunk 1 to chunk (N-1) are all size 1, and the length of chunk N is all size 2.
[0142] A schematic diagram of chunk interleaving when SliceNumX is 3 is shown in FIG. 4C. Take ChunkNum chunks as an example, and N chunks. First, encode chunk 1 of the first slice, then encode chunk 1 of the second slice, then encode chunk 1 of the third slice, then encode chunk 2 of the first slice, then encode chunk 2 of the second slice, then encode chunk 2 of the third slice, and so on until chunk N of the first slice is encoded, then chunk N of the second slice, then chunk N of the third slice is encoded. As shown in FIG. 4D, the lengths of chunk 1 to chunk (N-1) are all size 1, and the lengths of chunk N are all size 2.
[0143] In the third embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0144] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0145] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0146] In one possible embodiment, the total resources may be calculated using the following formula. total_resource = ((slice_width * slice_height * target_bpp + 7) >> 3) << 3, or total_resource = ((slice_width * slice_height * target_bpp + 7 + RC_BUFFER_LENGTH) >> 3) << 3
[0147] In the above formula, RC_BUFFER_LENGTH represents the length of the bitstream additionally buffered in the bitstream buffer. Obviously, since slice_width, slice_height, target_bpp, and RC_BUFFER_LENGTH are known values, the total resources can be calculated.
[0148] In one possible embodiment, based on the total resource total_resource, the number of chunks ChunkNum may be calculated using the following formula. ChunkNum = total_resource >> s + n
[0149] In the above formula, the chunk size value s may be a preset value based on experience, a value indicated by syntax parameters (e.g., image-level syntax parameters, sequence-level syntax parameters, etc.), and is not limited thereto. Optionally, 2 to the power of s may be the length of the chunk. Regarding the value of n in the above formula, the following formula may be adopted. n = total_resource % (1 << s) == 0? 0 : 1
[0150] That is, when total_resource % (1 << s) is 0, the value of n may be 0, and when total_resource % (1 << s) is not 0, the value of n may be 1.
[0151] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0152] For example, each slice may be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks may be calculated as follows: the length of the previous ChunkNum-1 chunks is size1, and the length of the last chunk is size2. Here, size1 may be determined based on a chunk size value, and size2 may be determined based on the total resources, the number of chunks, and the chunk size value. For example, size1=1< size2=total_resource-((Chunk Num-1)< <s))
[0153] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0154] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0155] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0156] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 4:
[0157] The actual number of coding bits of each slice is constant, for example, the actual number of coding bits of each slice is equal to the target number of transmission bits, the length of the following ChunkNum-1 chunks is constant and is a first size, and the length of the first chunk is not constant and is a second size.
[0158] In the fourth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0159] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0160] In step 2, calculate the total resource total_resource (i.e., the target transmission bit number), and determine the number of chunks ChunkNum according to the total resource. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0161] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0162] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0163] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0164] For example, the calculation method of the length of the ChunkNum chunks may refer to the related description for the decoding side in this embodiment below, and the description will be omitted here.
[0165] In step 5, the SliceNumX slices in one slice row are coded sequentially ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0166] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0167] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0168] Exemplarily, a schematic diagram of chunk interleaving when SliceNumX is 2 is shown in FIG. 5A, taking ChunkNum chunks as an example of N chunks, first encode chunk 1 of the first slice, then encode chunk 1 of the second slice, then encode chunk 2 of the first slice, then encode chunk 2 of the second slice, and so on until chunk N of the first slice is encoded, and then chunk N of the second slice is encoded. As shown in FIG. 5B, the length of chunk 1 is size 1, and the lengths of chunks 2 to N are all size 2.
[0169] Exemplarily, the interleaving process for chunks when SliceNumX is 3 may include first encoding chunk 1 of the first slice, then encoding chunk 1 of the second slice, then encoding chunk 1 of the third slice, then encoding chunk 2 of the first slice, then encoding chunk 2 of the second slice, then encoding chunk 2 of the third slice, and repeating in this manner until encoding chunk N of the first slice, then encoding chunk N of the second slice, then encoding chunk N of the third slice. As shown in FIG. 5C, the length of chunk 1 is size 1, and the lengths of chunks 2 to N are all size 2.
[0170] In the fourth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0171] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0172] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0173] In one possible embodiment, the total resources may be calculated using the following formula: total_resource=((slice_width*slice_height*target_bpp+7)>>3)<<3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0174] In one possible embodiment, the number of chunks ChunkNum may be calculated based on the total resource total_resource using the following formula: ChunkNum=total_resource>>s+n
[0175] In the above formula, the chunk size value s may be a value preset based on experience, or may be a value indicated by a syntax parameter. For the value of n, the following formula may be adopted: n=total_resource%(1< <s)==0?0:1
[0176] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0177] For example, each slice may be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks may be calculated as follows: the length of the first chunk is size1, and the length of the following ChunkNum-1 chunks is size2. Here, size2 may be determined based on the chunk size value, and size1 may be determined based on the total resources, the number of chunks, and the chunk size value. For example, size2=1< <s、 size1=total_resource-((Chunk Num-1)< <s))
[0178] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0179] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0180] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0181] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 5:
[0182] The actual number of coding bits of each slice is constant. For example, the actual number of coding bits of each slice is equal to the target number of transmission bits, the lengths of the remaining ChunkNum-1 chunks other than the k-th chunk are constant and are set to a first size, and the length of the k-th chunk is not constant and is set to a second size. The k-th chunk may be the last chunk of all the chunks, the first chunk of all the chunks, or any chunk between the first chunk and the last chunk of all the chunks.
[0183] In the fifth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0184] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0185] In step 2, calculate the total resource total_resource (i.e., the target transmission bit number), and determine the number of chunks ChunkNum according to the total resource. For details, please refer to the relevant description of the decoding side in this embodiment, and the description will be omitted here.
[0186] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0187] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0188] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0189] For example, the calculation method of the length of the ChunkNum chunks may refer to the related description for the decoding side in this embodiment below, and the description will be omitted here.
[0190] In step 5, the SliceNumX slices in one slice row are sequentially coded ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0191] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0192] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0193] In the fifth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0194] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0195] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0196] For example, the total resources are calculated using the following formula: total_resource=((slice_width*slice_height*target_bpp+7)>>3)<<3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0197] Based on the total resource, total_resource, the number of chunks, ChunkNum, may be calculated using the following formula: ChunkNum=total_resource>>s+n
[0198] Here, the chunk size value s is a preset value, and the following formula may be adopted for the value of n. n=total_resource%(1< <s)==0?0:1
[0199] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0200] For example, each slice may be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks may be calculated such that the length of the k-th chunk is size1 and the length of the remaining ChunkNum-1 chunks is size2. The value of k ranges from 1 to ChunkNum. Here, size2 may be determined based on the chunk size value, and size1 may be determined based on the total resources, the number of chunks, and the chunk size value. For example, size2=1< size1=total_resource-((Chunk Num-1)< <s))
[0201] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0202] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0203] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0204] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 6:
[0205] The actual number of coding bits of each slice is constant. For example, the actual number of coding bits of each slice is equal to the target number of transmission bits, the lengths of the remaining ChunkNum-1 chunks other than the k-th chunk are constant and are set to a first size, and the length of the k-th chunk is not constant and is set to a second size. The k-th chunk may be the last chunk of all the chunks, the first chunk of all the chunks, or any chunk between the first chunk and the last chunk of all the chunks.
[0206] In the sixth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0207] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0208] In step 2, calculate the total resource total_resource (i.e., the number of target transmission bits), and determine the number of chunks ChunkNum according to the slice height slice_height. For details, please refer to the relevant description of the decoding side in the present embodiment below, and the description will be omitted here.
[0209] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0210] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0211] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0212] For example, the calculation method of the length of the ChunkNum chunks may refer to the related description for the decoding side in this embodiment below, and the description will be omitted here.
[0213] In step 5, the SliceNumX slices in one slice row are sequentially coded ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0214] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0215] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0216] In the sixth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0217] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0218] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the slice height slice_height.
[0219] For example, the total resources are calculated using the following formula: total_resource = ((slice_width * slice_height * target_bpp + 7) >> 3) << 3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0220] Based on the slice height, slice_height, calculate the number of chunks, ChunkNum, using the following formula: ChunkNum=slice_height
[0221] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0222] For example, each slice may be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks may be calculated such that the length of the k-th chunk is size1 and the length of the remaining ChunkNum-1 chunks is size2. The value of k ranges from 1 to ChunkNum. Here, size2 may be determined based on the slice width and bits per pixel, and size1 may be determined based on the total resource, the number of chunks, and size2. For example, size2=((slice_width*bpp+7)<<3)>>3 size1=total_resource-((Chunk Num-1)*size2)
[0223] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0224] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0225] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0226] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 7:
[0227] The actual number of coding bits of each slice is constant. For example, the actual number of coding bits of each slice is equal to the target number of transmission bits, and the length of the previous ChunkNum-1 chunks is switched between two fixed values based on whether the chunks are odd or even. The lengths of the odd chunks are all the first size, and the lengths of the even chunks are all the second size. The length of the last chunk is not constant but is the third size.
[0228] In the seventh embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0229] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0230] In step 2, calculate the total resource total_resource (i.e., the target transmission bit number), and determine the number of chunks ChunkNum according to the total resource. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0231] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0232] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0233] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0234] For example, the calculation method of the length of the ChunkNum chunks may refer to the related description for the decoding side in this embodiment below, and the description will be omitted here.
[0235] In step 5, the SliceNumX slices in one slice row are sequentially coded ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0236] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0237] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0238] Exemplarily, when SliceNumX is 2, chunk interleaving may include first encoding chunk 1 of the first slice, then encoding chunk 1 of the second slice, then encoding chunk 2 of the first slice, then encoding chunk 2 of the second slice, and so on until encoding chunk N of the first slice and then encoding chunk N of the second slice. As shown in FIG. 6A , the length of odd-numbered chunks such as chunk 1, chunk 3, chunk 5, etc. of each slice is size 1, the length of even-numbered chunks such as chunk 2, chunk 4, chunk 6, etc. of each slice is size 2, and the length of the last chunk (i.e., chunk N) is size 3.
[0239] In the seventh embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0240] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0241] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0242] For example, the total resources are calculated using the following formula: total_resource = ((slice_width * slice_height * target_bpp + 7) >> 3) << 3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0243] Based on the total resource, total_resource, calculate the number of chunks, ChunkNum, using the following formula: ChunkNum=(total_resource>>s)<<1+n
[0244] Here, the chunk size value s is a preset value, and the following formula may be adopted for the value of n. n=total_resource%(1< <s)==0?0:1
[0245] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0246] For example, each slice can be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks is calculated by sequentially switching the length of the previous ChunkNum-1 chunks between two fixed values, size1 and size2 (for example, the length of odd-numbered chunks is size1 and the length of even-numbered chunks is size2, or the length of odd-numbered chunks is size2 and the length of even-numbered chunks is size1), and the length of the last chunk is size3. Here, size1 and size2 may both be determined based on the chunk size value, and size3 may be determined based on the total resources, the chunk size value, and the number of chunks. For example, size1=(1< <s)+x size2=(1< <s)-x size3=total_resource-((Chunk Num-1)< <s)
[0247] In the above formula, x is a preset value, which may be set empirically, for example, 1, 2, 3 or −1, −2, −3, etc., and may be indicated by an image level syntax parameter.
[0248] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0249] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0250] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0251] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 8:
[0252] The actual number of coding bits of each slice is constant. For example, the actual number of coding bits of each slice is equal to the target number of transmission bits, and the length of the following ChunkNum-1 chunks is switched between two fixed values based on odd-numbered chunks and even-numbered chunks (for example, the lengths of the odd-numbered chunks are all the first size, and the lengths of the even-numbered chunks are all the second size), and the length of the first chunk is not constant but is the third size.
[0253] In the eighth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0254] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0255] In step 2, calculate the total resource total_resource (i.e., the target transmission bit number), and determine the number of chunks ChunkNum according to the total resource. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0256] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0257] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0258] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0259] For example, the calculation method of the length of the ChunkNum chunks may refer to the related description for the decoding side in this embodiment below, and the description will be omitted here.
[0260] In step 5, the SliceNumX slices in one slice row are coded sequentially ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0261] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0262] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0263] Exemplarily, when SliceNumX is 2, chunk interleaving may include first encoding chunk 1 of the first slice, then encoding chunk 1 of the second slice, then encoding chunk 2 of the first slice, then encoding chunk 2 of the second slice, and so on until encoding chunk N of the first slice, then encoding chunk N of the second slice. As shown in FIG. 6B , the length of the first chunk (i.e., chunk 1) of each slice is size 1, and in the remaining chunks, the lengths of even-numbered chunks such as chunk 2, chunk 4, chunk 6, etc. of each slice are size 2, and the lengths of odd-numbered chunks such as chunk 3, chunk 5, chunk 7, etc. of each slice are size 3.
[0264] In the eighth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0265] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0266] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0267] For example, the total resources are calculated using the following formula: total_resource = ((slice_width * slice_height * target_bpp + 7) >> 3) << 3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0268] Based on the total resource, total_resource, calculate the number of chunks, ChunkNum, using the following formula: ChunkNum=(total_resource>>s)<<1+n
[0269] Here, the chunk size value s is a preset value, and the following formula may be adopted for the value of n. n=total_resource%(1< <s)==0?0:1
[0270] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0271] For example, each slice can be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks is calculated as follows: the length of the first chunk is size1, and the lengths of the following ChunkNum-1 chunks are switched between two fixed values, size2 and size3, in sequence. For example, the length of odd-numbered chunks is size2 and the length of even-numbered chunks is size3, or the length of odd-numbered chunks is size3 and the length of even-numbered chunks is size2. Here, size2 and size3 may both be determined based on the chunk size value, and size1 may be determined based on the total resources, the chunk size value, and the number of chunks. For example, size2=(1< <s)+x size3=(1< <s)-x size1=total_resource-((Chunk Num-1)< <s)
[0272] Here, x is a preset value.
[0273] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0274] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0275] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0276] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 9:
[0277] The actual number of encoded bits of each slice is constant. For example, the actual number of encoded bits of each slice is equal to the target number of transmission bits, and the lengths of the remaining ChunkNum-1 chunks other than the k-th chunk are switched between two fixed values based on whether the chunks are odd-numbered or even-numbered (for example, the lengths of the odd-numbered chunks are all the first size, and the lengths of the even-numbered chunks are all the second size), and the length of the k-th chunk is not constant and is a third size. The k-th chunk may be the last chunk of all chunks, the first chunk of all chunks, or any chunk between the first chunk and the last chunk of all chunks.
[0278] In the ninth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0279] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0280] In step 2, calculate the total resource total_resource (i.e., the target transmission bit number), and determine the number of chunks ChunkNum according to the total resource. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0281] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0282] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0283] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0284] For example, the calculation method of the length of the ChunkNum chunks may refer to the related description for the decoding side in this embodiment below, and the description will be omitted here.
[0285] In step 5, the SliceNumX slices in one slice row are coded sequentially ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0286] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0287] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0288] In the ninth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0289] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0290] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0291] For example, the total resources are calculated using the following formula: total_resource = ((slice_width * slice_height * target_bpp + 7) >> 3) << 3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0292] Based on the total resource, total_resource, calculate the number of chunks, ChunkNum, using the following formula: ChunkNum=(total_resource>>s)<<1+n
[0293] Here, s is a preset value, and the following formula may be adopted for the value of n. n=total_resource%(1< <s)==0?0:1
[0294] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0295] For example, each slice can be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks is calculated as follows: the length of the k-th chunk is size1, and the lengths of the remaining ChunkNum-1 chunks other than the k-th chunk are switched between two fixed values, size2 and size3, in sequence. For example, the length of odd-numbered chunks is size2 and the length of even-numbered chunks is size3, or the length of odd-numbered chunks is size3 and the length of even-numbered chunks is size2. Here, size2 and size3 may both be determined based on the chunk size value, and size1 may be determined based on the total resources, the chunk size value, and the number of chunks. For example, size2=(1< <s)+x size3=(1< <s)-x size1=total_resource-((Chunk Num-1)< <s)
[0296] Here, x is a preset value. An odd-numbered chunk is an odd-numbered chunk among the remaining ChunkNum-1 chunks, and an even-numbered chunk is an even-numbered chunk among the remaining ChunkNum-1 chunks.
[0297] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0298] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0299] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0300] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 10:
[0301] The actual number of encoded bits of each slice is constant. For example, the actual number of encoded bits of each slice is equal to the target number of transmission bits, and the lengths of the remaining ChunkNum-1 chunks other than the k-th chunk are switched between two fixed values based on whether the chunks are odd-numbered or even-numbered (for example, the lengths of the odd-numbered chunks are all the first size, and the lengths of the even-numbered chunks are all the second size), and the length of the k-th chunk is not constant and is a third size. The k-th chunk may be the last chunk of all chunks, the first chunk of all chunks, or any chunk between the first chunk and the last chunk of all chunks.
[0302] In the tenth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0303] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0304] In step 2, calculate the total resource total_resource (i.e., the number of target transmission bits), and determine the number of chunks ChunkNum according to the slice height slice_height. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0305] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0306] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0307] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0308] For example, the calculation method of the length of the ChunkNum chunks may refer to the related description for the decoding side in this embodiment below, and the description will be omitted here.
[0309] In step 5, the SliceNumX slices in one slice row are sequentially coded ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0310] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0311] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0312] In the tenth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0313] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0314] In step 2, the total resource (i.e., the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the slice height slice_height.
[0315] For example, the total resources are calculated using the following formula: total_resource=((slice_width*slice_height*target_bpp+7)>>3)<<3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0316] Based on the slice height, slice_height, the number of chunks, ChunkNum, may be calculated using the following formula: ChunkNum=slice_height+1
[0317] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0318] For example, each slice can be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks is calculated as follows: the length of the k-th chunk is size1, and the lengths of the remaining ChunkNum-1 chunks other than the k-th chunk are switched between two fixed values, size2 and size3, in sequence. The value of k ranges from 1 to ChunkNum. For example, the length of the odd-numbered chunks is size2 and the length of the even-numbered chunks is size3, or the length of the odd-numbered chunks is size3 and the length of the even-numbered chunks is size2. Here, size2 and size3 may both be determined based on the slice width and bits per pixel, and size1 may be determined based on the total resources, the number of chunks, and size2. For example, size2=(((slice_width*bpp)<<3)>>3)+x size3=(((slice_width*bpp)<<3)>>3)-x size1=total_resource-((Chunk Num-1)*(size2-x))
[0319] Here, x is a preset value. An odd chunk is an odd chunk among the remaining ChunkNum-1 chunks, and an even chunk is an even chunk among the remaining ChunkNum-1 chunks. In the above formula, (((slice_width*bpp)<<3)>>3) may be expressed as the number of pixels in a slice row, which is determined based on the slice width and bits per pixel.
[0320] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0321] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0322] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0323] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 11:
[0324] The actual number of coded bits for each slice is constant. The actual number of coded bits for each slice is determined based on the length of all chunks, i.e., the sum of the lengths of all chunks, rather than the target number of transmission bits. By zero-padding and byte-aligning the bitstream buffer, the length of all chunks is switched between two fixed values based on odd-numbered chunks and even-numbered chunks (e.g., the length of all odd-numbered chunks is the first size, and the length of all even-numbered chunks is the second size). The length of the bitstream buffer is the sum of the length of the chunks of the first size and the length of the chunks of the second size.
[0325] In the eleventh embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0326] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0327] In step 2, calculate the total resource total_resource (i.e., the target transmission bit number), and determine the number of chunks ChunkNum according to the total resource. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0328] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0329] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be encoded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment may be performed on the bitstream buffer so that the actual number of encoded bits is the sum of the lengths of all chunks. The sum of the lengths of all chunks may be equal to or greater than the target number of transmission bits. That is, zero padding and byte alignment may be performed on the bitstream buffer based on the lengths of all chunks.
[0330] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0331] For example, the calculation method of the length of the ChunkNum chunks may refer to the related description for the decoding side in this embodiment below, and the description will be omitted here.
[0332] In step 5, the SliceNumX slices in one slice row are coded sequentially ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0333] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0334] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0335] Exemplarily, chunk interleaving when SliceNumX is 2 may include first encoding chunk 1 of the first slice, then encoding chunk 1 of the second slice, then encoding chunk 2 of the first slice, then encoding chunk 2 of the second slice, and so on until encoding chunk N of the first slice, then encoding chunk N of the second slice. As shown in FIG. 6C , the lengths of odd-numbered chunks such as chunk 1, chunk 3, chunk 5, etc. of each slice are size 1, and the lengths of even-numbered chunks such as chunk 2, chunk 4, chunk 6, etc. of each slice are size 2.
[0336] In the embodiment 11, on the decoding side, the decoding method can be realized using the following steps.
[0337] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0338] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0339] For example, the total resources are calculated using the following formula: total_resource = ((slice_width * slice_height * target_bpp + 7) >> 3) << 3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0340] Based on the total resource, total_resource, the number of chunks, ChunkNum, may be calculated using the following formula: ChunkNum=(total_resource>>s)<<1+n
[0341] In the above formula, the set chunk size value s may be indicated by an image level syntax parameter, and the following formula may be adopted for the value of n: left=(total_resource-(Chunk Num-1)< <s) n=left==0?0:(left<=(1< <s+x)?1:2)
[0342] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0343] For example, each slice can be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks is calculated by sequentially switching the length of all chunks (i.e., ChunkNum chunks) between two fixed values, size1 and size2. For example, the length of odd-numbered chunks is size1 and the length of even-numbered chunks is size2, or the length of odd-numbered chunks is size2 and the length of even-numbered chunks is size1. Here, size1 and size2 may both be determined based on the chunk size value. For example, size1=(1< <s)+x size2=(1< <s)-x
[0344] where x is a preset value. Obviously, the bitstream buffer will perform zero padding and byte alignment based on the length of every chunk, so that the length of every chunk will be switched between size1 and size2 sequentially.
[0345] For example, assume that there are SliceNumX slices in a slice, and after generating SliceNumX bitstream buffers, the length of the bitstream buffer is 340, and the target number of transmission bits is 360. In the third to tenth embodiments, zero padding and byte alignment are performed on the bitstream buffer so that the length of the bitstream buffer increases from 340 to 360. That is, the length that needs to be zero padded is 20. In the eleventh embodiment, assume that size1 is 99, size2 is 101, and the number of chunks ChunkNum is 4. In this case, the length of the bitstream buffer needs to be 400, that is, the sum of the lengths of two size1 and two size2. Therefore, when zero padding and byte alignment are performed on the bitstream buffer, the length of the bitstream buffer needs to be increased from 340 to 400, that is, the length that needs to be zero padded is 60. This allows the length of all chunks to be switched between size1 and size2.
[0346] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0347] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0348] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0349] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 12:
[0350] The actual number of coded bits for each slice is constant. The actual number of coded bits for each slice is determined based on the length of all chunks, i.e., the sum of the lengths of all chunks, rather than the target number of transmission bits. By zero-padding and byte-aligning the bitstream buffer, the length of all chunks is switched between two fixed values based on odd-numbered chunks and even-numbered chunks (e.g., the length of all odd-numbered chunks is the first size, and the length of all even-numbered chunks is the second size). The length of the bitstream buffer is the sum of the length of the chunks of the first size and the length of the chunks of the second size.
[0351] In the twelfth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0352] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0353] In step 2, calculate the total resource total_resource (i.e., the number of target transmission bits), and determine the number of chunks ChunkNum according to the slice height slice_height. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0354] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0355] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment may be performed on the bitstream buffer so that the length of the bitstream buffer is the sum of the lengths of all chunks. The sum of the lengths of all chunks may be greater than the target transmission bit number. That is, zero padding and byte alignment may be performed on the bitstream buffer based on the lengths of all chunks.
[0356] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0357] For example, the calculation method of the length of the ChunkNum chunks may refer to the related description for the decoding side in this embodiment below, and the description will be omitted here.
[0358] In step 5, the SliceNumX slices in one slice row are sequentially coded ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0359] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0360] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0361] In the twelfth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0362] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0363] In step 2, the total resource (i.e., the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the slice height slice_height.
[0364] For example, the total resources are calculated using the following formula: total_resource=((slice_width*slice_height*target_bpp+7)>>3)<<3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0365] Furthermore, based on the slice height, slice_height, the number of chunks, ChunkNum, may be calculated using the following formula: ChunkNum=slice_height
[0366] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0367] For example, each slice can be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks is calculated by sequentially switching the length of all the ChunkNum chunks between two fixed values, size1 and size2. For example, the length of odd-numbered chunks is size1 and the length of even-numbered chunks is size2, or the length of odd-numbered chunks is size2 and the length of even-numbered chunks is size1. Here, size1 and size2 may both be determined based on the number of pixels in a slice row, and the number of pixels in a slice row is determined based on the slice width and bits per pixel. For example, size1=(((slice_width*bpp+7)<<3)>>3)+x size2=(((slice_width*bpp+7)<<3)>>3)-x
[0368] Here, x is a preset value. Illustratively, the bitstream buffer performs zero padding and byte alignment based on the length of every chunk, so that the length of every chunk is switched between size1 and size2 in sequence.
[0369] For example, assume that there are SliceNumX slices in a slice, and after generating SliceNumX bitstream buffers, the length of the bitstream buffer is 340. Suppose size1 is 99, size2 is 101, and the number of chunks ChunkNum is 4. In this case, the length of the bitstream buffer needs to be 400, i.e., the sum of the lengths of two size1 and two size2. Therefore, when zero padding and byte alignment is performed on the bitstream buffer, the length of the bitstream buffer needs to be changed from 340 to 400, i.e., the length that needs to be zero padded is 60. This switches the length of all chunks between size1 and size2.
[0370] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0371] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0372] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0373] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 13:
[0374] The length of the bitstream buffer of each slice is not the target transmission bit number but the actual number of encoded bits, i.e., no zero padding and byte alignment is performed on the bitstream buffer. For example, if the length of the bitstream buffer is 340 after encoding a slice to generate a bitstream buffer, the actual number of encoded bits in the bitstream buffer is 340, and no additional zero padding operation is required. The length of the previous ChunkNum-1 chunks is constant and is a first size, and the length of the last chunk is not constant and is a second size. In addition, the bitstream needs to include chunk length indication information corresponding to the last chunk, and the chunk length indication information is used to indicate the length of the last chunk, i.e., the length of the second size.
[0375] In the thirteenth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0376] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0377] In step 2, calculate the total resource total_resource (i.e., the target transmission bit number), and determine the number of chunks ChunkNum according to the total resource. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0378] In step 3, the SliceNumX slices in each slice row are sequentially encoded to generate SliceNumX bitstream buffers, and the actual number of encoded bits real_bit corresponding to each bitstream buffer is calculated.
[0379] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. After obtaining the SliceNumX bitstream buffers, no zero padding or byte alignment is performed on the bitstream buffers. That is, the length of the bitstream buffer is the actual number of coded bits. In addition, the actual number of coded bits real_bit corresponding to each bitstream buffer may be calculated.
[0380] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0381] For example, the length of the ChunkNum chunks may be calculated as follows: the length of the previous ChunkNum-1 chunks is size1, and the length of the last chunk is size2. Here, size1 may be determined based on the chunk size value, and size2 may be determined based on the actual number of coding bits, the number of chunks, and the chunk size value. For example, size1=1< size2=real_bit-((Chunk Num-1)< <s)
[0382] In step 5, the SliceNumX slices in one slice row are sequentially coded ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0383] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0384] Exemplarily, before encoding the last chunk, chunk header information (also called chunk length indication information) may be encoded in the bitstream to indicate the length of the last chunk, i.e., the value of size2. For example, the chunk header information may be encoded using a fixed number of bits, for example, a fixed 16 bits.
[0385] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0386] For example, when SliceNumX is 2, the chunk interleaving process first encodes chunk 1 of the first slice, then encodes chunk 1 of the second slice, then encodes chunk 2 of the first slice, then encodes chunk 2 of the second slice, and so on until chunk N-1 of the first slice is encoded, then chunk N-1 of the second slice is encoded, then chunk header information 1 of chunk N of the first slice indicating the length of chunk N of the first slice, then encodes chunk N of the first slice, then encodes chunk header information 2 of chunk N of the second slice indicating the length of chunk N of the second slice, and then encodes chunk N of the second slice. As shown in Figure 7A, the lengths of chunk 1 to chunk (N-1) are all size 1, the length of chunk N in the first slice is not constant and the length is indicated by the chunk N header information of the first slice, and the length of chunk N in the second slice is also not constant (it may be the same as or different from the length of chunk N in the first slice) and the length is indicated by the chunk N header information of the second slice.
[0387] In the embodiment 13, on the decoding side, the decoding method can be realized using the following steps.
[0388] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0389] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0390] For example, the total resources are calculated using the following formula: total_resource=((slice_width*slice_height*target_bpp+7)>>3)<<3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0391] Based on the total resource, total_resource, calculate the number of chunks, ChunkNum, using the following formula: ChunkNum=(total_resource-RC_BUFFER_LENGTH)>>s+1
[0392] Here, the chunk size value s is a preset value and may be indicated by a picture level syntax parameter.
[0393] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0394] Exemplarily, before parsing the last chunk from the bitstream, chunk header information of the chunk may be parsed first, and the chunk header information is used to indicate the length of the last chunk. The chunk header information may be parsed using a fixed number of bits, for example, 16 bits. The last chunk is parsed from the bitstream based on the value indicated by the chunk header information. For example, first, chunk header information of the last chunk of the first slice is parsed from the bitstream, and the last chunk of the first slice is parsed based on the chunk header information, and then chunk header information of the last chunk of the second slice is parsed from the bitstream, and the last chunk of the second slice is parsed based on the chunk header information.
[0395] Exemplarily, for each slice, it is possible to perform analysis ChunkNum times to obtain ChunkNum chunks. The calculation method for the lengths of the ChunkNum chunks may be such that the lengths of the previous ChunkNum - 1 chunks are size1, and the length of the last chunk may be size2. For example, size1 = 1 << s, and size2 is the value indicated by the chunk header information of the last chunk.
[0396] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0397] In a possible embodiment, if there are chunks in the bitstream buffers corresponding to SliceNumX slices, the decoding of the chunks corresponding to the SliceNumX slices is started. Here, the presence of chunks in the bitstream buffers corresponding to the SliceNumX slices may include, but is not limited to, the presence of T chunks corresponding to each slice in the bitstream buffer corresponding to that slice, where T is 1 or more and T is less than the number of chunks.
[0398] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0399] In step 6, it is determined whether the analysis of the bitstreams of all slice rows has ended. If not, the process returns to step 3 to analyze the next slice row. If it has ended, the decoding process of the current image is completed, and the next image may be analyzed. Example 14:
[0400] The length of the bitstream buffer for each slice is the actual number of encoded bits, not the target number of transmission bits, i.e., no zero padding or byte alignment is performed on the bitstream buffer. The length of the subsequent ChunkNum-1 chunks is constant and is a first size, and the length of the first chunk is not constant and is a second size. In addition, the bitstream needs to include chunk length indication information corresponding to the first chunk, and the chunk length indication information is used to indicate the length of the first chunk.
[0401] In the fourteenth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0402] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0403] In step 2, calculate the total resource total_resource (i.e., the target transmission bit number), and determine the number of chunks ChunkNum according to the total resource. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0404] In step 3, the SliceNumX slices in each slice row are sequentially encoded to generate SliceNumX bitstream buffers, and the actual number of encoded bits real_bit corresponding to each bitstream buffer is calculated.
[0405] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices are encoded and SliceNumX bitstream buffers corresponding to the SliceNumX slices are obtained. After obtaining the SliceNumX bitstream buffers, no zero padding or byte alignment is performed on the bitstream buffers, that is, the length of the bitstream buffer is the actual number of encoded bits.
[0406] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0407] For example, the length of the ChunkNum chunks may be calculated as follows: the length of the first chunk is size1, and the length of the following ChunkNum-1 chunks is size2. Here, size2 may be determined based on the chunk size value, and size1 may be determined based on the actual number of coding bits, the number of chunks, and the chunk size value. For example, size2=1< size1=real_bit-((Chunk Num-1)< <s)
[0408] In step 5, the SliceNumX slices in one slice row are sequentially coded ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0409] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0410] Exemplarily, before encoding the first chunk, chunk header information (also called chunk length indication information) may be encoded in the bitstream to indicate the length of the first chunk, i.e., the value of size1. For example, the chunk header information may be encoded using a fixed number of bits, for example, a fixed 16 bits.
[0411] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0412] By way of example, chunk interleaving when SliceNumX is 2 may include first encoding chunk header information 1 of chunk 1 of the first slice to indicate the length of chunk 1 of the first slice, then encoding chunk 1 of the first slice, then encoding chunk header information 2 of chunk 1 of the second slice to indicate the length of chunk 1 of the second slice, then encoding chunk 1 of the second slice, then encoding chunk 2 of the first slice, then encoding chunk 2 of the second slice, then encoding chunk 3 of the first slice, then encoding chunk 3 of the second slice, and so on until encoding chunk N of the first slice and then encoding chunk N of the second slice. As shown in Figure 7B, the lengths of chunks 2 to N are all size 1, the length of chunk 1 in the first slice is not constant and the length is indicated by the chunk 1 header information of the first slice, and the length of chunk 1 in the second slice is also not constant (it may be the same as or different from the length of chunk 1 in the first slice) and the length is indicated by the chunk 1 header information of the second slice.
[0413] In the fourteenth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0414] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0415] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0416] For example, the total resources are calculated using the following formula: total_resource=((slice_width*slice_height*target_bpp+7)>>3)<<3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0417] Based on the total resource, total_resource, calculate the number of chunks, ChunkNum, using the following formula: ChunkNum=(total_resource-RC_BUFFER_LENGTH)>>s+1
[0418] Here, the chunk size value s may be indicated by a picture level syntax parameter.
[0419] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0420] Exemplarily, before parsing the first chunk from the bitstream, the chunk header information of the chunk may be parsed first, and the chunk header information may be used to indicate the length of the first chunk. The chunk header information may be parsed using a fixed number of bits, for example, 16 bits.
[0421] Based on the value indicated by the chunk header information, the first chunk is parsed from the bitstream. For example, first, the chunk header information of the first chunk of the first slice is parsed from the bitstream, the first chunk of the first slice is parsed based on the chunk header information, then the chunk header information of the first chunk of the second slice is parsed from the bitstream, and the first chunk of the second slice is parsed based on the chunk header information.
[0422] Exemplarily, for each slice, it is possible to parse ChunkNum times to obtain ChunkNum chunks. The calculation method for the lengths of the ChunkNum chunks may be such that the length of the first chunk is size1, and the lengths of the subsequent ChunkNum - 1 chunks may be size2. For example, size2 = 1 << s, and size1 is the value indicated by the chunk header information of the first chunk.
[0423] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0424] In a possible embodiment, if there are chunks in the bitstream buffers corresponding to SliceNumX slices, the decoding of the chunks corresponding to the SliceNumX slices is started. Here, the presence of chunks in the bitstream buffers corresponding to the SliceNumX slices may include, but is not limited to, that for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is 1 or more and T is smaller than the number of chunks.
[0425] In step 5, after the decoding of each slice is completed, the reconstructed image of each slice is obtained.
[0426] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 15:
[0427] The length of the bitstream buffer for each slice is the actual number of encoded bits, not the target number of transmission bits, i.e., no zero padding or byte alignment is performed on the bitstream buffer. The remaining ChunkNum-1 chunks other than the k-th chunk have a constant length and are a first size, and the length of the k-th chunk is not constant and is a second size. In addition, the bitstream needs to include chunk length indication information corresponding to the k-th chunk, and the chunk length indication information is used to indicate the length of the k-th chunk. The k-th chunk may be the last chunk of all the chunks, the first chunk of all the chunks, or any chunk between the first chunk and the last chunk of all the chunks.
[0428] In the fifteenth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0429] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0430] In step 2, calculate the total resource total_resource (i.e., the target transmission bit number), and determine the number of chunks ChunkNum according to the total resource. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0431] In step 3, the SliceNumX slices in each slice row are sequentially encoded to generate SliceNumX bitstream buffers, and the actual number of encoded bits real_bit corresponding to each bitstream buffer is calculated.
[0432] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices are encoded and SliceNumX bitstream buffers corresponding to the SliceNumX slices are obtained. After obtaining the SliceNumX bitstream buffers, no zero padding or byte alignment is performed on the bitstream buffers, that is, the length of the bitstream buffer is the actual number of encoded bits.
[0433] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0434] For example, the length of the ChunkNum chunks may be calculated as follows: the length of the k-th chunk is size1, and the lengths of the remaining ChunkNum-1 chunks are size2. The value of k ranges from 1 to ChunkNum. Here, size2 may be determined based on the chunk size value, and size1 may be determined based on the actual number of coding bits, the number of chunks, and the chunk size value. For example, size2=1< size1=real_bit-((Chunk Num-1)< <s)
[0435] In step 5, the SliceNumX slices in one slice row are sequentially coded ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0436] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0437] Exemplarily, before encoding the k-th chunk, chunk header information (also called chunk length indication information) may be encoded in the bitstream to indicate the length of the k-th chunk, i.e., the value of size1. For example, the chunk header information may be encoded using a fixed number of bits, for example, a fixed 16 bits.
[0438] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0439] In the fifteenth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0440] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0441] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0442] For example, the total resources are calculated using the following formula: total_resource=((slice_width*slice_height*target_bpp+7)>>3)<<3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0443] Based on the total resource, total_resource, calculate the number of chunks, ChunkNum, using the following formula: ChunkNum=(total_resource-RC_BUFFER_LENGTH)>>s+1
[0444] Here, the set chunk size value s may be indicated by a picture level syntax parameter.
[0445] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0446] Exemplarily, before parsing the k-th chunk from the bitstream, the chunk header information of the chunk may be parsed first, where the chunk header information is used to indicate the length of the k-th chunk. The chunk header information may be parsed using a fixed number of bits, for example, 16 bits.
[0447] The k-th chunk is parsed from the bitstream based on the value indicated by the chunk header information. For example, first, chunk header information of the k-th chunk of the first slice is parsed from the bitstream, and the k-th chunk of the first slice is parsed based on the chunk header information, and then chunk header information of the k-th chunk of the second slice is parsed from the bitstream, and the k-th chunk of the second slice is parsed based on the chunk header information.
[0448] Exemplarily, for each slice, it is possible to perform analysis ChunkNum times to obtain ChunkNum chunks. The calculation method for the lengths of the ChunkNum chunks may be such that the length of the k-th chunk is size1, and the lengths of the remaining ChunkNum - 1 chunks may be size2. For example, size2 = 1 << s, and size1 is the value indicated by the chunk header information of the k-th chunk.
[0449] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0450] In a possible embodiment, if there are chunks in the bitstream buffers corresponding to SliceNumX slices, the decoding of the chunks corresponding to the SliceNumX slices is started. Here, the presence of chunks in the bitstream buffers corresponding to the SliceNumX slices may include, but is not limited to, that for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is 1 or more and T is smaller than the number of chunks.
[0451] In step 5, after the decoding of each slice is completed, the reconstructed image of each slice is obtained.
[0452] In step 6, it is determined whether the analysis of the bitstreams of all slice rows has ended. If not, return to step 3 to analyze the next slice row. If it has ended, the decoding process of the current image is completed, and the next image may be analyzed. Example 16:
[0453] The length of the bitstream buffer for each slice is the actual number of encoded bits, not the target number of transmission bits, i.e., no zero padding or byte alignment is performed on the bitstream buffer. The remaining ChunkNum-1 chunks other than the k-th chunk have a constant length and are a first size, and the length of the k-th chunk is not constant and is a second size. In addition, the bitstream needs to include chunk length indication information corresponding to the k-th chunk, and the chunk length indication information is used to indicate the length of the k-th chunk. The k-th chunk may be the last chunk of all the chunks, the first chunk of all the chunks, or any chunk between the first chunk and the last chunk of all the chunks.
[0454] In the sixteenth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0455] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0456] In step 2, calculate the total resource total_resource (i.e., the number of target transmission bits), and determine the number of chunks ChunkNum according to the slice height slice_height. For details, please refer to the relevant description of the decoding side in the present embodiment below, and the description will be omitted here.
[0457] In step 3, the SliceNumX slices in each slice row are sequentially encoded to generate SliceNumX bitstream buffers, and the actual number of encoded bits real_bit corresponding to each bitstream buffer is calculated.
[0458] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices are encoded and SliceNumX bitstream buffers corresponding to the SliceNumX slices are obtained. After obtaining the SliceNumX bitstream buffers, no zero padding or byte alignment is performed on the bitstream buffers, that is, the length of the bitstream buffer is the actual number of encoded bits.
[0459] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0460] For example, the length of the ChunkNum chunks may be calculated as follows: the length of the k-th chunk is size1, and the length of the remaining ChunkNum-1 chunks is size2. The value of k ranges from 1 to ChunkNum. Here, size2 may be determined based on the slice width and bits per pixel, and size1 may be determined based on the actual number of coding bits, the number of chunks, and size2. For example, size2=(((slice_width*bpp)<<3)>>3) size1=real_bit-((Chunk Num-1)*size2)
[0461] In step 5, the SliceNumX slices in one slice row are coded sequentially ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0462] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0463] Exemplarily, before encoding the k-th chunk, chunk header information (also called chunk length indication information) may be encoded in the bitstream to indicate the length of the k-th chunk, i.e., the value of size1. For example, the chunk header information may be encoded using a fixed number of bits, for example, a fixed 16 bits.
[0464] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0465] In the sixteenth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0466] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0467] In step 2, the total resource (i.e., the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the slice height slice_height.
[0468] For example, the total resources are calculated using the following formula: total_resource=((slice_width*slice_height*target_bpp+7)>>3)<<3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0469] Furthermore, based on the slice height, slice_height, the number of chunks, ChunkNum, may be calculated using the following formula: ChunkNum=slice_height
[0470] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0471] Exemplarily, before parsing the k-th chunk from the bitstream, the chunk header information of the chunk may be parsed first, where the chunk header information is used to indicate the length of the k-th chunk. The chunk header information may be parsed using a fixed number of bits, for example, 16 bits.
[0472] The k-th chunk is parsed from the bitstream based on the value indicated by the chunk header information. For example, first, chunk header information of the k-th chunk of the first slice is parsed from the bitstream, and the k-th chunk of the first slice is parsed based on the chunk header information, and then chunk header information of the k-th chunk of the second slice is parsed from the bitstream, and the k-th chunk of the second slice is parsed based on the chunk header information.
[0473] For example, each slice may be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks may be calculated as follows: the length of the k-th chunk is size1, and the length of the remaining ChunkNum-1 chunks is size2, where size2=(((slice_width*bpp)<<3)>>3), and size1 is a value indicated by the chunk header information of the k-th chunk.
[0474] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0475] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0476] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0477] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 17:
[0478] The actual number of coding bits of each slice is constant. For example, the actual number of coding bits of each slice is equal to the target transmission bit number, the length of the previous ChunkNum-1 chunks is constant and is a first size, and the length of the last chunk is not constant and is a second size. In addition, the bitstream needs to include chunk length indication information corresponding to the last chunk, and the chunk length indication information is used to indicate the length of the last chunk.
[0479] In the seventeenth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0480] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0481] In step 2, calculate the total resource total_resource (i.e., the target transmission bit number), and determine the number of chunks ChunkNum according to the total resource. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0482] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0483] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0484] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0485] Exemplarily, the calculation manner of the length of ChunkNum chunks may be that the length of the previous ChunkNum-1 chunks is size1, and the length of the last chunk is size2, where size1 may be determined based on the chunk size value, and size2 may be determined based on the total resources, the number of chunks, and the chunk size value. For example, size1=1< size2=total_resource-((Chunk Num-1)< <s))
[0486] In step 5, the SliceNumX slices in one slice row are coded sequentially ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0487] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0488] Exemplarily, before encoding the last chunk, chunk header information (also called chunk length indication information) may be encoded in the bitstream to indicate the length of the last chunk, i.e., the value of size2. The chunk header information may be encoded using a fixed number of bits, for example, a fixed 16 bits.
[0489] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0490] Exemplarily, chunk interleaving when SliceNumX is 2 may include encoding chunk 1 of the first slice, encoding chunk 1 of the second slice, encoding chunk 2 of the first slice, encoding chunk 2 of the second slice, and repeating in this manner until encoding chunk N-1 of the first slice and encoding chunk N-1 of the second slice, then encoding chunk header information 1 of chunk N of the first slice to indicate the length of chunk N of the first slice, encoding chunk N of the first slice, encoding chunk header information 2 of chunk N of the second slice to indicate the length of chunk N of the second slice, and encoding chunk N of the second slice. As shown in Figure 8A, the lengths of chunks 1 to (N-1) are all size 1, the length of chunk N in the first slice is not constant and the length is indicated by the chunk N header information of the first slice, and the length of chunk N in the second slice is also not constant and the length is indicated by the chunk N header information of the second slice.
[0491] In the seventeenth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0492] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0493] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0494] For example, the total resources are calculated using the following formula: total_resource=((slice_width*slice_height*target_bpp+7)>>3)<<3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0495] Based on the total resource, total_resource, calculate the number of chunks, ChunkNum, using the following formula: ChunkNum=(total_resource)>>s+n
[0496] Here, the chunk size value s is a preset value, and the following formula may be adopted for the value of n. n=total_resource%(1< <s)==0?0:1
[0497] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0498] Exemplarily, before parsing the last chunk from the bitstream, chunk header information of the chunk may be parsed first, and the chunk header information is used to indicate the length of the last chunk. The chunk header information may be parsed using a fixed number of bits, for example, 16 bits. The last chunk is parsed from the bitstream based on the value indicated by the chunk header information. For example, first, chunk header information of the last chunk of the first slice is parsed from the bitstream, and the last chunk of the first slice is parsed based on the chunk header information, and then chunk header information of the last chunk of the second slice is parsed from the bitstream, and the last chunk of the second slice is parsed based on the chunk header information.
[0499] Exemplarily, for each slice, it is possible to perform analysis ChunkNum times to obtain ChunkNum chunks. The calculation method for the lengths of the ChunkNum chunks may be such that the lengths of the previous ChunkNum - 1 chunks are size1, and the length of the last chunk may be size2. For example, size1 = 1 << s, and size2 is the value indicated by the chunk header information of the last chunk.
[0500] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0501] In a possible embodiment, if there are chunks in the bitstream buffers corresponding to SliceNumX slices, the decoding of the chunks corresponding to the SliceNumX slices is started. Here, the existence of chunks in the bitstream buffers corresponding to the SliceNumX slices may include that for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, but is not limited thereto, where T is 1 or more and T is less than the number of chunks.
[0502] In step 5, after the decoding of each slice is completed, the reconstructed image of each slice is obtained.
[0503] In step 6, it is determined whether the analysis of the bitstreams of all slice rows has ended. If not, return to step 3 to analyze the next slice row. If it has ended, the decoding process of the current image is completed, and the next image may be analyzed. Example 18:
[0504] The actual number of coding bits of each slice is constant. For example, the actual number of coding bits of each slice is equal to the target transmission bit number, the length of the following ChunkNum-1 chunks is constant and is a first size, and the length of the first chunk is not constant and is a second size. In addition, the bitstream needs to include chunk length indication information corresponding to the first chunk, and the chunk length indication information is used to indicate the length of the first chunk.
[0505] In the eighteenth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0506] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0507] In step 2, calculate the total resource total_resource (i.e., the target transmission bit number), and determine the number of chunks ChunkNum according to the total resource. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0508] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0509] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0510] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0511] For example, the length of the ChunkNum chunks may be calculated as follows: the length of the first chunk is size1, and the length of the following ChunkNum-1 chunks is size2. Here, size2 may be determined based on the chunk size value, and size1 may be determined based on the total resources, the number of chunks, and the chunk size value. For example, size2=1< size1=total_resource-((Chunk Num-1)< <s))
[0512] In step 5, the SliceNumX slices in one slice row are coded sequentially ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0513] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0514] Exemplarily, before encoding the first chunk, chunk header information (also called chunk length indication information) may be encoded in the bitstream to indicate the length of the first chunk, i.e., the value of size1. The chunk header information may be encoded using a fixed number of bits, for example, a fixed 16 bits.
[0515] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0516] By way of example, chunk interleaving when SliceNumX is equal to 2 may include encoding chunk header information 1 of chunk 1 of the first slice to indicate the length of chunk 1 of the first slice, encoding chunk 1 of the first slice, encoding chunk 1 of the first slice, encoding chunk header information 2 of chunk 1 of the second slice to indicate the length of chunk 1 of the second slice, encoding chunk 1 of the second slice, then encoding chunk 2 of the first slice, encoding chunk 2 of the second slice, encoding chunk 3 of the first slice, encoding chunk 3 of the second slice, and repeating in this manner until chunk N of the first slice has been encoded and chunk N of the second slice has been encoded. As shown in Figure 8B, which is a schematic diagram of the chunk lengths, the lengths of chunk 2 to chunk N are all size 1, the length of chunk 1 in the first slice is not constant and the length is indicated by the chunk 1 header information of the first slice, and the length of chunk 1 in the second slice is not constant and the length is indicated by the chunk 1 header information of the second slice.
[0517] In the eighteenth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0518] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0519] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0520] For example, the total resources are calculated using the following formula: total_resource = ((slice_width * slice_height * target_bpp + 7) >> 3) << 3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0521] Based on the total resource, total_resource, calculate the number of chunks, ChunkNum, using the following formula: ChunkNum=(total_resource)>>s+n
[0522] Here, the chunk size value s is a preset value, and the following formula may be adopted for the value of n. n=total_resource%(1< <s)==0?0:1
[0523] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0524] Exemplarily, before parsing the first chunk from the bitstream, chunk header information of the chunk may be parsed first, and the chunk header information is used to indicate the length of the first chunk. The chunk header information may be parsed using a fixed number of bits, for example, 16 bits. The first chunk is parsed from the bitstream based on the value indicated by the chunk header information. For example, first, chunk header information of the first chunk of the first slice is parsed from the bitstream, and the first chunk of the first slice is parsed based on the chunk header information, and then chunk header information of the first chunk of the second slice is parsed from the bitstream, and the first chunk of the second slice is parsed based on the chunk header information.
[0525] Exemplarily, for each slice, it is possible to perform analysis ChunkNum times to obtain ChunkNum chunks. The calculation method for the lengths of the ChunkNum chunks may be such that the length of the first chunk is size1, and the lengths of the subsequent ChunkNum - 1 chunks may be size2. For example, size2 = 1 << s, and size1 is the value indicated by the chunk header information of the first chunk.
[0526] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0527] In a possible embodiment, if there are chunks in the bitstream buffers corresponding to SliceNumX slices, the decoding of the chunks corresponding to the SliceNumX slices is started. Here, the presence of chunks in the bitstream buffers corresponding to the SliceNumX slices may include, but is not limited to, the presence of T chunks corresponding to each slice in the bitstream buffer corresponding to that slice, where T is 1 or more and T is less than the number of chunks.
[0528] In step 5, after the decoding of each slice is completed, the reconstructed image of each slice is obtained.
[0529] In step 6, it is determined whether the analysis of the bitstreams of all slice rows has ended. If not, return to step 3 to analyze the next slice row. If it has ended, the decoding process of the current image is completed, and the next image may be analyzed. Example 19:
[0530] The actual number of coding bits of each slice is constant. For example, the actual number of coding bits of each slice is equal to the target transmission bit number, the length of the remaining ChunkNum-1 chunks other than the k-th chunk is constant and is a first size, and the length of the k-th chunk is not constant and is a second size. In addition, the bit stream needs to include chunk length indication information corresponding to the k-th chunk, and the chunk length indication information is used to indicate the length of the k-th chunk. The k-th chunk may be the last chunk of all chunks, may be the first chunk of all chunks, or may be any chunk between the first chunk and the last chunk of all chunks.
[0531] In the nineteenth embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0532] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0533] In step 2, calculate the total resource total_resource (i.e., the target transmission bit number), and determine the number of chunks ChunkNum according to the total resource. Specifically, refer to the relevant description of the decoding side in this embodiment below, and the description is omitted here.
[0534] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0535] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0536] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0537] Exemplarily, the calculation manner of the lengths of the ChunkNum chunks may be such that the length of the k-th chunk is size1, and the lengths of the remaining ChunkNum-1 chunks are size2, where size2 may be determined based on the chunk size value, and size1 may be determined based on the total resources, the number of chunks, and the chunk size value. For example, size2=1< size1=total_resource-((Chunk Num-1)< <s))
[0538] In step 5, the SliceNumX slices in one slice row are coded sequentially ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0539] Exemplarily, before encoding the k-th chunk, chunk header information (also called chunk length indication information) may be encoded in the bitstream to indicate the length of the k-th chunk, i.e., the value of size1. For example, the chunk header information may be encoded using a fixed number of bits, for example, a fixed 16 bits.
[0540] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0541] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0542] In the nineteenth embodiment, on the decoding side, the decoding method can be realized using the following steps.
[0543] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0544] In step 2, the total resource total_resource (ie, the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the total resource.
[0545] For example, the total resources are calculated using the following formula: total_resource=((slice_width*slice_height*target_bpp+7)>>3)<<3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0546] Based on the total resource, total_resource, calculate the number of chunks, ChunkNum, using the following formula: ChunkNum=(total_resource)>>s+n
[0547] The chunk size value s is a preset value, and for the value of n, the following formula may be adopted. n = total_resource%(1<<s)==0?0:1
[0548] In step 3, receive the bitstream, and for the SliceNum slices in each slice row, sequentially analyze ChunkNum times, and each time analyze SliceNumX chunks and deinterleave them into the bitstream buffer of each slice.
[0549] Exemplarily, before analyzing the k-th chunk from the bitstream, first, the chunk header information of the chunk may be analyzed, and the chunk header information is used to indicate the length of the k-th chunk. The chunk header information may be analyzed using a fixed number of bits, for example, 16 bits. Based on the value indicated by the chunk header information, analyze the k-th chunk from the bitstream.
[0550] Exemplarily, for each slice, it is possible to analyze ChunkNum times to obtain ChunkNum chunks. The calculation method for the lengths of the ChunkNum chunks may be such that the length of the k-th chunk is size1, and the lengths of the remaining ChunkNum - 1 chunks are size2. For example, size2 = 1<<s, and size1 is the value indicated by the chunk header information of the k-th chunk.
[0551] In step 4, decode each slice based on the bitstream buffer of each slice.
[0552] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0553] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0554] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 20:
[0555] The actual number of coding bits of each slice is constant. For example, the actual number of coding bits of each slice is equal to the target transmission bit number, the length of the remaining ChunkNum-1 chunks other than the k-th chunk is constant and is a first size, and the length of the k-th chunk is not constant and is a second size. In addition, the bit stream needs to include chunk length indication information corresponding to the k-th chunk, and the chunk length indication information is used to indicate the length of the k-th chunk. The k-th chunk may be the last chunk of all chunks, may be the first chunk of all chunks, or may be any chunk between the first chunk and the last chunk of all chunks.
[0556] In the embodiment 20, on the encoding side, the encoding method can be realized using the following steps.
[0557] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0558] In step 2, calculate the total resource total_resource (i.e., the number of target transmission bits), and determine the number of chunks ChunkNum according to the slice height slice_height. For details, please refer to the relevant description of the decoding side in the present embodiment below, and the description will be omitted here.
[0559] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0560] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0561] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0562] Exemplarily, the calculation method of the lengths of the ChunkNum chunks may be such that the length of the k-th chunk is size1, and the lengths of the remaining ChunkNum-1 chunks are size2. The value of k ranges from 1 to ChunkNum. Here, size2 may be determined based on the slice width and bits per pixel, and size1 may be determined based on the total resource, the number of chunks, and size2. For example, size2=(((slice_width*bpp+7)<<3)>>3) size1=total_resource-((Chunk Num-1)*size2)
[0563] In step 5, the SliceNumX slices in one slice row are coded sequentially ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0564] Exemplarily, before encoding the k-th chunk, chunk header information (also called chunk length indication information) may be encoded in the bitstream to indicate the length of the k-th chunk, i.e., the value of size1. For example, the chunk header information may be encoded using a fixed number of bits, for example, a fixed 16 bits.
[0565] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0566] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0567] In the embodiment 20, on the decoding side, the decoding method can be realized using the following steps.
[0568] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0569] In step 2, the total resource (i.e., the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the slice height slice_height.
[0570] For example, the total resources are calculated using the following formula: total_resource=((slice_width*slice_height*target_bpp+7)>>3)<<3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0571] Based on the slice height, slice_height, the number of chunks, ChunkNum, may be calculated using the following formula: ChunkNum=slice_height
[0572] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0573] Exemplarily, before parsing the k-th chunk from the bitstream, chunk header information of the chunk may be parsed first, where the chunk header information is used to indicate the length of the k-th chunk. The chunk header information may be parsed using a fixed number of bits, for example, 16 bits. Based on the value indicated by the chunk header information, the k-th chunk is parsed from the bitstream.
[0574] For example, each slice may be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks may be calculated as follows: the length of the k-th chunk is size1, and the length of the remaining ChunkNum-1 chunks is size2, where size2=(((slice_width*bpp+7)<<3)>>3), and size1 is a value indicated by the chunk header information of the k-th chunk.
[0575] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0576] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0577] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0578] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed. Example 21:
[0579] The actual number of coding bits of each slice is constant. For example, the actual number of coding bits of each slice is equal to the target transmission bit number, the length of the remaining ChunkNum-1 chunks other than the k-th chunk is constant and is a first size, and the length of the k-th chunk is not constant and is a second size. In addition, the bit stream needs to include chunk length indication information corresponding to the k-th chunk, and the chunk length indication information is used to indicate the length of the k-th chunk. The k-th chunk may be the last chunk of all chunks, may be the first chunk of all chunks, or may be any chunk between the first chunk and the last chunk of all chunks.
[0580] In the twenty-first embodiment, on the encoding side, the encoding method can be realized using the following steps.
[0581] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0582] In step 2, calculate the total resource total_resource (i.e., the number of target transmission bits), and determine the number of chunks ChunkNum according to the slice height slice_height. For details, please refer to the relevant description of the decoding side in the present embodiment below, and the description will be omitted here.
[0583] In step 3, the SliceNumX slices in each slice row are coded sequentially, SliceNumX bitstream buffers are generated, and the bitstream buffers are zero-filled and byte-aligned.
[0584] For example, since there are SliceNumX slices in each slice row, the SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero padding and byte alignment can be performed on the bitstream buffer so that the length of the bitstream buffer is the target transmission bit number. That is, zero padding and byte alignment are performed on the bitstream buffer based on the target transmission bit number.
[0585] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0586] Exemplarily, the calculation manner of the lengths of the ChunkNum chunks may be that the length of the k-th chunk is size1, and the lengths of the remaining ChunkNum-1 chunks are size2, where size2 may be determined based on the slice width and bits per pixel, and size1 may be determined based on the total resource, the number of chunks, and size2. For example, size2=(((slice_width*bpp)<<3)>>3) size1=total_resource-((Chunk Num-1)*size2)
[0587] Example 21 is different from Example 20 in the calculation formula of size2. That is, since each byte is 8 bits, in Example 20, there is an operation of "+7", which increases the length of the chunk by 1 byte, whereas in Example 21, there is no operation of "+7", and the length of the chunk is shortened by 1 byte.
[0588] In step 5, the SliceNumX slices in one slice row are coded sequentially ChunkNum times, and chunks of SliceNumX slices are interleaved each time to form a bitstream.
[0589] Exemplarily, before encoding the k-th chunk, chunk header information (also called chunk length indication information) may be encoded in the bitstream to indicate the length of the k-th chunk, i.e., the value of size1. The chunk header information may be encoded using a fixed number of bits, for example, a fixed 16 bits.
[0590] In one possible embodiment, when the chunks corresponding to all slices in a slice row have been obtained, start interleaving the chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining the chunks corresponding to all slices in a slice row includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and is less than the number of chunks.
[0591] In step 6, it is determined whether or not the encoding of all slice rows has been completed. If not, the process returns to step 3 and the next slice row is encoded.
[0592] In the embodiment 21, on the decoding side, the decoding method can be realized using the following steps.
[0593] In step 1, the image is divided horizontally and vertically into SliceNumX*SliceNumY rectangular slices.
[0594] In step 2, the total resource (i.e., the target number of transmission bits) is calculated, and the number of chunks ChunkNum is determined based on the slice height slice_height.
[0595] For example, the total resources are calculated using the following formula: total_resource=((slice_width*slice_height*target_bpp+7)>>3)<<3, or total_resource=((slice_width*slice_height*target_bpp+7+RC_BUFFER_LENGTH)>>3)<<3
[0596] Based on the slice height, slice_height, the number of chunks, ChunkNum, may be calculated using the following formula: ChunkNum=slice_height+1
[0597] In step 3, receive the bitstream, and parse the SliceNumX slices in each slice row sequentially ChunkNum times, and parse SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0598] Exemplarily, before parsing the k-th chunk from the bitstream, chunk header information of the chunk may be parsed first, where the chunk header information is used to indicate the length of the k-th chunk. The chunk header information may be parsed using a fixed number of bits, for example, 16 bits. Based on the value indicated by the chunk header information, the k-th chunk is parsed from the bitstream.
[0599] For example, each slice may be parsed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks may be calculated as follows: the length of the k-th chunk is size1, and the length of the remaining ChunkNum-1 chunks is size2, where size2=(((slice_width*bpp)<<3)>>3), and size1 is a value indicated by the chunk header information of the k-th chunk.
[0600] In step 4, each slice is decoded based on the bitstream buffer of each slice.
[0601] In one possible embodiment, start decoding the chunks corresponding to the SliceNumX slices if there are chunks in the bitstream buffer corresponding to the SliceNumX slices, where the presence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and less than the number of chunks.
[0602] In step 5, after the decoding of each slice is completed, a reconstructed image of each slice is obtained.
[0603] In step 6, it is determined whether the analysis of the bitstream of all slice rows has been completed. If not, return to step 3 and analyze the next slice row. If completed, the decoding process of the current image is completed and the next image may be analyzed.
[0604] The above-mentioned embodiments may be implemented alone or in combination. For example, each embodiment in the first to twenty-first embodiments may be implemented alone or at least two of the first to twenty-first embodiments may be implemented in combination. The explanation of the parameters in each embodiment above may also be applied to the other embodiments. For example, the explanation of the first embodiment may be applied to the second to twenty-first embodiments, and the explanation of the third embodiment may be applied to the fourth to twenty-first embodiments.
[0605] In each of the above embodiments, the contents of the encoding side may be applied to the decoding side, and the contents of the decoding side may be applied to the encoding side. Example 22:
[0606] Based on a similar idea to the above method, an embodiment of the present invention further provides a decoding device applied to the decoding side, the decoding device including a memory configured to store video data and a decoder configured to implement the decoding method in any one of the above embodiments 1 to 21.
[0607] For example, in one possible embodiment, the decoder is configured to divide a to-be-processed image into X*Y slices, where X represents the number of slices in a horizontal direction of the to-be-processed image and Y represents the number of slices in a vertical direction of the to-be-processed image, and X is a positive integer greater than 1, and Y is a positive integer equal to or greater than 1; determine a number Z of chunks in each slice, where Z represents the number of chunks included in each slice; for each of Y slice rows corresponding to the to-be-processed image, deinterleaving chunks corresponding to X slices in the horizontal direction of the slice row in the target bitstream to obtain Z chunks corresponding to each of the X slices; and decode the X slices based on bitstream buffers corresponding to the X slices in the horizontal direction of the slice row, where the Z chunks include chunks of at least two sizes, and a bitstream buffer corresponding to each slice includes chunks corresponding to the slice.
[0608] Based on a similar idea to the above method, an embodiment of the present invention further provides an encoding device applied to the encoding side, the encoding device including a memory configured to store video data, and an encoder configured to implement the encoding method in any one of the above embodiments 1 to 21.
[0609] For example, in one possible embodiment, the encoder is configured to: divide a to-be-processed image into X*Y slices, where X represents the number of slices in a horizontal direction of the to-be-processed image, and Y represents the number of slices in a vertical direction of the to-be-processed image, and X is a positive integer greater than 1, and Y is a positive integer equal to or greater than 1; determine a number Z of chunks in each slice, where Z represents the number of chunks included in each slice; for each of Y slice rows corresponding to the to-be-processed image, encode X slices in the horizontal direction of the slice row, obtain X bitstream buffers corresponding to the X slices; for each of the X bitstream buffers, divide the bitstream buffer into Z chunks, interleave the chunks corresponding to the X slices in the horizontal direction of the slice row to obtain a target bitstream; and send the target bitstream to a decoding side, where the Z chunks include chunks of at least two different sizes.
[0610] Based on the same idea as the above method, a schematic diagram of a hardware architecture of a decoding device (also called a video decoder) according to an embodiment of the present invention specifically includes a processor 911 and a machine-readable storage medium 912, as shown in Fig. 9A. Here, the machine-readable storage medium 912 stores machine-executable instructions executable by the processor 911, and the processor 911 is used to execute the decoding methods disclosed in the above embodiments 1 to 21 of the present invention by executing the machine-executable instructions.
[0611] Based on the same idea as the above method, a schematic diagram of a hardware architecture of an encoding device (also called a video encoder) according to an embodiment of the present invention specifically includes a processor 921 and a machine-readable storage medium 922, as shown in Fig. 9B, where the machine-readable storage medium 922 stores machine-executable instructions executable by the processor 921, and the processor 921 is used to execute the encoding methods disclosed in the above embodiments 1 to 21 of the present invention by executing the machine-executable instructions.
[0612] Based on a similar idea to the above method, an embodiment of the present invention further provides a machine-readable storage medium having a plurality of computer instructions stored thereon, which, when executed by a processor, can realize the methods disclosed in the above examples of the present invention, such as the decoding method or the encoding method in each of the above embodiments.
[0613] Based on the same idea as the above method, an embodiment of the present invention further provides a computer application program, which, when executed by a processor, can realize the decoding method or the encoding method disclosed in the above embodiment of the present invention.
[0614] Based on the same idea as the above method, an embodiment of the present invention further provides a decoding device applied to a decoding side, the decoding device including: a division module for dividing a target image into X*Y slices, X represents the number of slices in a horizontal direction of the target image, Y represents the number of slices in a vertical direction of the target image, X is a positive integer greater than 1, and Y is a positive integer greater than or equal to 1; a determination module for determining a number Z of chunks in each slice, Z represents the number of chunks included in each slice; and a decoding module for, for each of Y slice rows corresponding to the target image, deinterleaving chunks corresponding to X slices in the horizontal direction of the slice row in a target bitstream to obtain Z chunks corresponding to each of the X slices, and decoding the X slices based on bitstream buffers corresponding to the X slices in the horizontal direction of the slice row, where the Z chunks include chunks of at least two sizes, and a bitstream buffer corresponding to each slice includes a chunk corresponding to the slice.
[0615] Exemplarily, the determination module is specifically configured to determine a target number of transmission bits based on a slice width, a slice height, and a target bit per pixel, determine the number of chunks based on the target number of transmission bits and a set chunk size value, or determine the number of chunks based on a slice height.
[0616] Exemplarily, the decoding module specifically parses one chunk corresponding to each slice into a bitstream buffer corresponding to the slice based on the order of the X slices in the horizontal direction of the slice row, determines whether all Z chunks of each slice have been parsed, and if it determines that all Z chunks of each slice have been parsed, completes deinterleaving of the X slices and obtains all Z chunks corresponding to each slice; if it determines that all Z chunks of each slice have not been parsed, returns to the operation of sequentially parsing one chunk corresponding to each slice into a bitstream buffer corresponding to the slice based on the order of the X slices in the horizontal direction of the slice row.
[0617] Exemplarily, the decoding module is specifically configured to start decoding the chunks corresponding to the X slices when there are chunks in the bitstream buffer corresponding to the X slices, and the presence of chunks in the bitstream buffer corresponding to the X slices includes, for each slice, there are T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is equal to or greater than 1 and is less than the number of chunks.
[0618] Based on the same idea as the above method, an embodiment of the present invention further provides an encoding device applied to an encoding side, the encoding device including: a division module for dividing a target image into X*Y slices, X represents the number of slices in a horizontal direction of the target image, Y represents the number of slices in a vertical direction of the target image, X is a positive integer greater than 1, and Y is a positive integer greater than or equal to 1; a determination module for determining a number Z of chunks in each slice, Z represents the number of chunks included in each slice; an encoding module for, for each of Y slice rows corresponding to the target image, encoding X slices in the horizontal direction of the slice row, obtaining X bitstream buffers corresponding to the X slices, and for each of the X bitstream buffers, dividing the bitstream buffer into Z chunks and interleaving the chunks corresponding to the X slices in the horizontal direction of the slice row to obtain a target bitstream, the Z chunks including at least two kinds of chunks; and a transmission module for transmitting the target bitstream to a decoding side.
[0619] Exemplarily, the determination module is specifically configured to determine a target number of transmission bits based on a slice width, a slice height, and a target bit per pixel, determine the number of chunks based on the target number of transmission bits and a set chunk size value, or determine the number of chunks based on a slice height.
[0620] Exemplarily, the encoding module is specifically configured to: sequentially add one chunk corresponding to each of the X slices to the current bitstream based on the order of the X slices in the horizontal direction of the slice row; determine whether all Z chunks of each slice have been added to the current bitstream; if it is determined that all Z chunks of each slice have been added to the current bitstream, stop adding chunks and set the current bitstream to the target bitstream; if it is determined that all Z chunks of each slice have not been added to the current bitstream, return to performing the operation of sequentially adding one chunk corresponding to each of the X slices to the current bitstream based on the order of the X slices in the horizontal direction of the slice row.
[0621] Exemplarily, the encoding module is specifically configured to, when chunks corresponding to the X slices are obtained, start interleaving the chunks corresponding to the X slices to obtain a target bitstream, where the chunks corresponding to the X slices are obtained including, for each slice, S chunks corresponding to the slice are obtained, where S is equal to or greater than 1 and is smaller than the number of chunks.
[0622] Based on the same idea as the above method, an embodiment of the present invention further provides a camera device, which may include the encoding side and / or the decoding side in any of the above embodiments.
[0623] Based on the same idea as the above method, an embodiment of the present invention further provides a machine-readable storage medium having a plurality of computer instructions stored thereon, which, when executed by a processor, implements the encoding / decoding method disclosed in the above embodiment of the present invention. Here, the machine-readable storage medium may be any electronic, magnetic, optical, or other physical storage device, and may contain or store information such as executable instructions, data, etc. For example, the machine-readable storage medium may be a RAM (Radom Access Memory), a volatile memory, a non-volatile memory, a flash memory, a storage drive (e.g., a hard disk drive), a solid-state drive, any type of storage disk (e.g., an optical disk, a dvd, etc.), or a similar storage medium, or a combination thereof.
[0624] The system, device, module or unit described in the above embodiments may be realized by a computer chip or entity, or may be realized by a product having some function. A typical implementation device is a computer, and the form of the computer may be a personal computer, a laptop computer, a mobile phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an e-mail sending and receiving device, a game machine, a tablet PC, a wearable device, or any combination of these devices.
[0625] For convenience of description, the above device will be described as being divided into units according to their functions. Of course, when implementing the present invention, the functions of each unit can be realized by the same or multiple pieces of software and / or hardware.
[0626] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, a system, or a computer program product. The present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, embodiments of the present invention may take the form of a computer program product embodied in one or more computer usable storage mediums (including, but not limited to, magnetic disk storage devices, CD-ROMs, optical storage devices, etc.) having computer usable program code therein.
[0627] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be realized by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, a special purpose computer, an embedded processor, or other programmable data processing device to generate a machine, and the instructions executed by the processor of the general purpose computer or other programmable data processing device generate an apparatus for implementing the functions specified in a flow or flows of the flowcharts and / or a block or blocks of the block diagrams. Furthermore, these computer program instructions may be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specified manner, and the instructions stored in the computer-readable memory generate an article of manufacture including an instruction apparatus, and the instruction apparatus realizes the functions specified in a flow or flows of the flowcharts and / or a block or blocks of the block diagrams.
[0628] These computer program instructions can also be loaded into a computer or other programmable data processing device, and a series of operational steps are executed on the computer or other programmable device to generate a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more flows of the flowchart and / or one or more blocks of the block diagram. The above description is merely an embodiment of the present invention, and is not intended to limit the present invention. Various changes and modifications of the present invention are possible for those skilled in the art. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention should be included within the scope of the claims of the present invention.
Claims
1. dividing a target image into X*Y slices, where X represents the number of slices in a horizontal direction of the target image, Y represents the number of slices in a vertical direction of the target image, X is a positive integer greater than 1, and Y is a positive integer equal to or greater than 1; determining a number Z of chunks in each slice, Z representing the number of chunks contained in each slice; For each of the Y slice rows corresponding to the processing target image, Encode X slices in the horizontal direction of the slice row, and obtain X bitstream buffers corresponding to the X slices; For each of the X bitstream buffers, dividing the bitstream buffer into Z chunks; interleaving chunks corresponding to X slices in the horizontal direction of the slice row to obtain a target bitstream; transmitting the target bitstream to a decoding side; wherein the Z chunks include chunks of at least two different sizes.
13. An encoding method comprising:
2. Determining the number of chunks Z in each slice can be done by: determining a target number of transmission bits based on a slice width, a slice height, and a target bits per pixel, and determining the number of chunks based on the target number of transmission bits and a configured chunk size value; or determining the number of chunks based on a slice height; 2. The method of claim 1 .
3. Interleaving chunks corresponding to X slices in the horizontal direction of the slice row to obtain a target bitstream includes: Sequentially adding one chunk corresponding to each of the X slices to the current bitstream based on an order of the X slices in a horizontal direction of the slice row, and determining whether all Z chunks of each slice have been added to the current bitstream; if it determines that all Z chunks for each slice have been added to the current bitstream, stop adding chunks and make the current bitstream the target bitstream; if it is determined that all Z chunks of each slice have not been added to the current bitstream, returning to the step of sequentially adding one chunk corresponding to each of the X slices to the current bitstream based on the order of the X slices in the horizontal direction of the slice row; 2. The method of claim 1 .
4. Interleaving chunks corresponding to X slices in the horizontal direction of the slice row to obtain a target bitstream includes: when the chunks corresponding to the X slices are obtained, starting interleaving the chunks corresponding to the X slices to obtain a target bitstream; Here, the chunks corresponding to the X slices are obtained including, for each of the X slices, S chunks corresponding to the slice are obtained, where S is equal to or greater than 1 and S is less than the Z.
2. The method of claim 1 .
5. When the number of actual encoded bits is constant, the lengths of the Z chunks other than the k-th chunk are all a first size, and the length of the k-th chunk is a second size; The first size is determined based on a configured chunk size value; the second size is determined based on a target number of transmission bits, the chunk size value, and the number of chunks.
2. The method of claim 1 .
6. When the number of actual encoded bits is constant, the lengths of the Z chunks other than the k-th chunk are all a first size, and the length of the k-th chunk is a second size; the first size is determined based on a slice width and bits per pixel; the second size is determined based on a target number of transmission bits, the first size, and the number of chunks.
2. The method of claim 1 .
7. When the number of actual encoded bits is not constant, the lengths of the remaining chunks other than the k-th chunk are all a first size, and the length of the k-th chunk is a second size, for the Z chunks; The first size is determined based on a configured chunk size value; the second size is determined based on an actual number of coded bits in the bitstream buffer, the chunk size value, and the number of chunks; the target bitstream further includes chunk length indication information for indicating the second size.
2. The method of claim 1 .
8. When the number of actual encoded bits is not constant, the lengths of the remaining chunks other than the k-th chunk are all a first size, and the length of the k-th chunk is a second size, for the Z chunks; the first size is determined based on a slice width and bits per pixel; the second size is determined based on an actual number of coded bits in the bitstream buffer, the first size, and the number of chunks; the target bitstream further includes chunk length indication information for indicating the second size.
2. The method of claim 1 .
9. When the number of actual encoded bits is constant, the lengths of the Z chunks other than the k-th chunk are all a first size, and the length of the k-th chunk is a second size; The first size is determined based on a configured chunk size value; the second size is determined based on a target number of transmission bits, the chunk size value, and the number of chunks; the target bitstream further includes chunk length indication information for indicating the second size.
2. The method of claim 1 .
10. When the number of actual encoded bits is constant, the lengths of the Z chunks other than the k-th chunk are all a first size, and the length of the k-th chunk is a second size; the first size is determined based on a slice width and bits per pixel; the second size is determined based on a target number of transmission bits, the first size, and the number of chunks; the target bitstream further includes chunk length indication information for indicating the second size.
2. The method of claim 1 .
11. The k-th chunk is The last chunk of the Z chunks, or The first chunk of the Z chunks, or Among the Z chunks, the chunk is any chunk between the first chunk and the last chunk. The method according to any one of claims 5 to 10.
12. dividing a target image into X*Y slices, where X represents the number of slices in a horizontal direction of the target image, Y represents the number of slices in a vertical direction of the target image, X is a positive integer greater than 1, and Y is a positive integer equal to or greater than 1; determining a number Z of chunks in each slice, Z representing the number of chunks contained in each slice; For each of the Y slice rows corresponding to the processing target image, deinterleaving chunks corresponding to X slices in a horizontal direction of the slice row in the target bitstream to obtain Z chunks corresponding to each of the X slices; and decoding the X slices based on a bitstream buffer corresponding to the X slices in the horizontal direction of the slice row; Here, the Z chunks include chunks of at least two different sizes, and a bitstream buffer corresponding to each slice includes chunks corresponding to the slice.
4. A decoding method comprising:
13. Determining the number of chunks Z in each slice can be done by: determining a target number of transmission bits based on a slice width, a slice height, and a target bits per pixel, and determining the number of chunks based on the target number of transmission bits and a configured chunk size value; or determining the number of chunks based on a slice height; 13. The method of claim 12.
14. Deinterleaving chunks corresponding to X slices in a horizontal direction of the slice row in the target bitstream to obtain Z chunks corresponding to each of the X slices, Sequentially parsing one chunk for each slice into a bitstream buffer corresponding to the slice based on an order of the X slices in a horizontal direction of the slice row, and determining whether all Z chunks for each slice have been parsed; If it is determined that all Z chunks of each slice have been parsed, complete the deinterleaving of the X slices to obtain all Z chunks corresponding to each slice; if it is determined that all Z chunks of each slice have not been parsed, returning to sequentially parsing one chunk corresponding to each slice into the bitstream buffer corresponding to the slice based on an order of the X slices in the horizontal direction of the slice row; 13. The method of claim 12.
15. Decoding the X slices based on a bitstream buffer corresponding to the X slices in the horizontal direction of the slice row includes: starting decoding of chunks corresponding to the X slices if chunks exist in the bitstream buffer corresponding to the X slices; wherein the presence of chunks in the bitstream buffer corresponding to the X slices includes, for each of the X slices, the presence of T chunks in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and is less than the Z.
15. The method according to claim 12 or 14.
16. For the Z chunks, the lengths of the remaining chunks other than the k-th chunk are all a first size, and the length of the k-th chunk is a second size; The first size is determined based on a configured chunk size value; the second size is determined based on a target number of transmission bits, the chunk size value, and the number of chunks.
13. The method of claim 12.
17. For the Z chunks, the lengths of the remaining chunks other than the k-th chunk are all a first size, and the length of the k-th chunk is a second size; the first size is determined based on a slice width and bits per pixel; the second size is determined based on a target number of transmission bits, the first size, and the number of chunks.
13. The method of claim 12.
18. For the Z chunks, the lengths of the remaining chunks other than the k-th chunk are all a first size, and the length of the k-th chunk is a second size; The first size is determined based on a configured chunk size value; the second size is determined based on chunk length indication information included in the target bitstream.
13. The method of claim 12.
19. For the Z chunks, the lengths of the remaining chunks other than the k-th chunk are all a first size, and the length of the k-th chunk is a second size; the first size is determined based on a slice width and bits per pixel; the second size is determined based on chunk length indication information included in the target bitstream.
13. The method of claim 12.
20. The k-th chunk is The last chunk of the Z chunks, or The first chunk of the Z chunks, or Among the Z chunks, the chunk is any chunk between the first chunk and the last chunk.
20. The method according to any one of claims 16 to 19.
21. a segmentation module for segmenting a target image into X*Y slices, where X represents a number of slices in a horizontal direction of the target image and Y represents a number of slices in a vertical direction of the target image, X being a positive integer greater than 1 and Y being a positive integer equal to or greater than 1; a determination module for determining a number Z of chunks in each slice, Z representing the number of chunks contained in each slice; For each of the Y slice rows corresponding to the processing target image, Encode X slices in the horizontal direction of the slice row, and obtain X bitstream buffers corresponding to the X slices; For each of the X bitstream buffers, dividing the bitstream buffer into Z chunks; an encoding module for interleaving chunks corresponding to X slices in a horizontal direction of the slice row to obtain a target bitstream, the Z chunks including chunks of at least two different sizes; a transmission module for transmitting the target bitstream to a decoding side, 13. An encoding device comprising:
22. a segmentation module for segmenting a target image into X*Y slices, where X represents a number of slices in a horizontal direction of the target image and Y represents a number of slices in a vertical direction of the target image, X being a positive integer greater than 1 and Y being a positive integer equal to or greater than 1; a determination module for determining a number Z of chunks in each slice, Z representing the number of chunks contained in each slice; For each of the Y slice rows corresponding to the processing target image, deinterleaving chunks corresponding to X slices in a horizontal direction of the slice row in the target bitstream to obtain Z chunks corresponding to each of the X slices; a decoding module for decoding the X slices based on a bitstream buffer corresponding to the X slices in the horizontal direction of the slice row; Here, the Z chunks include chunks of at least two different sizes, and a bitstream buffer corresponding to each slice includes chunks corresponding to the slice. A decoding device comprising:
23. 1. An encoding device, comprising: a machine-readable storage medium having machine-executable instructions stored thereon; a processor; The processor is adapted to execute the machine-executable instructions to perform the method steps of any one of claims 1 to 11.
1. An encoding device comprising:
24. 1. A decoding device, comprising: a machine-readable storage medium having machine-executable instructions stored thereon; a processor; The processor is adapted to execute the machine-executable instructions to perform the method steps of any one of claims 12 to 20. A decoding device comprising:
Citation Information
Patent Citations
Moving image encoding device and method of controlling the same
JP2010034802A
Methods of Multiple-Slice Coding for Frame Buffer Compression
US20150187045A1