Encoding and decoding method, device and its equipment
By dividing images into slices and interleaving chunks for encoding, and deinterleaving for decoding, the method addresses storage and delay issues in high-resolution image processing, facilitating efficient parallel decoding.
Patent Information
- Application Number
- JP2024555204
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2022-03-18
- Filing Date
- 2023-03-17
- Publication Date
- 2026-01-26
- Estimated Expiration
- 2043-03-17
AI Technical Summary
High-resolution image encoding and decoding requires significant storage resources and long buffering times for parallel processing, which cannot meet the delay requirements of low-latency scenarios.
The image is divided into slices, which are further divided into chunks of varying sizes, and these chunks are interleaved to form a target bitstream for encoding, while the decoding side deinterleaves and decodes these chunks in parallel without full buffering.
This approach reduces storage requirements and decoding delay, enabling efficient parallel decoding in low-latency scenarios.
Smart Images

Figure 0007806287000001 
Figure 0007806287000002 
Figure 0007806287000003
Abstract
Description
[Technical Field]
[0001] The present invention relates to the technical field of encoding and decoding, and more particularly to an encoding and decoding method, apparatus and device thereof. [Background technology]
[0002] Video images are encoded before transmission, and a complete video encoding method may include processes such as prediction, transformation, quantization, entropy coding, and filtering. Predictive encoding can include intra-coding and inter-coding. Inter-coding utilizes the temporal correlation of video to predict pixels of a current image using pixels of adjacent encoded images, thereby achieving the purpose of eliminating temporal redundancy in video. Intra-coding takes into account the strong spatial correlation between adjacent blocks in a current image, and predicts a block that is not currently encoded using surrounding reconstructed pixels as reference pixels. Subsequent encoding processes can be performed on residual values rather than original values, effectively eliminating spatial redundancy.
[0003] For each coding block, the original input signal is predicted to generate a residual signal, and temporal and spatial redundancies are removed. The residual signal is then 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 involves encoding the non-binary coded information into binary information and outputting a binary bitstream after removing coding redundancies. That is, the entropy-coded binary bitstream 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 sequentially send the bitstreams of each slice (i.e., the binary bitstreams after entropy encoding) to the decoding side. In the video decoding process, the decoding side receives the bitstream and sequentially decodes each slice based on 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. This requires buffering the bitstreams of all slices of the entire image, 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. This means that it takes a long time to complete the buffering, which cannot meet the delay requirements of low-latency scenarios. Summary of the Invention
[0006] The present invention provides an encoding method, the method comprising: Dividing a target image into X*Y slices, where X represents the number of slices in the horizontal direction of the target image, Y represents the number of slices in the 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 the number Z of chunks in each slice, where Z represents 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 decoding method, said method comprising: Dividing a target image into X*Y slices, where X represents the number of slices in the horizontal direction of the target image, Y represents the number of slices in the 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 the number Z of chunks in each slice, where Z represents the number of chunks contained in each slice; For each of the Y slice rows corresponding to the image to be processed, 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; decoding the X slices in the horizontal direction of the slice row based on a bitstream buffer corresponding to the X slices; Here, the Z chunks include chunks of at least two different sizes, and the bitstream buffer corresponding to each slice includes 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, where X represents the number of slices in the horizontal direction of the processing target image, Y represents the number of slices in the 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 in each slice, Z, where Z represents the number of chunks contained within each slice; For each of Y slice rows corresponding to the image to be processed, 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, where X represents the number of slices in the horizontal direction of the processing target image, Y represents the number of slices in the 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 in each slice, Z, where Z represents the number of chunks contained within each slice; for each of Y slice rows corresponding to the image to be processed, 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 bitstream buffers 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 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. [Effects 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, thereby saving storage resources and meeting the delay requirements of low-latency scenarios. [Brief explanation of the drawings]
[0013] [Figure 1A] FIG. 2 is a schematic diagram of encoding and decoding according to one embodiment of the present invention; [Figure 1B] FIG. 2 is a schematic diagram of encoding and decoding according to one embodiment of the present invention; [Figure 1C-1] FIG. 2 is a schematic diagram of encoding and decoding according to one embodiment of the present invention; [Figure 1C-2]FIG. 2 is a schematic diagram of encoding and decoding according to one embodiment of the present invention; [Figure 1C-3] FIG. 2 is a schematic diagram of encoding and decoding according to one embodiment of the present invention; [Figure 1D] FIG. 2 is a schematic diagram of encoding and decoding according to one embodiment of the present invention; [Figure 1E] FIG. 2 is a schematic diagram of encoding and decoding according to one embodiment of the present invention; [Figure 1F] FIG. 2 is a schematic diagram of encoding and decoding according to one embodiment of the present invention; [Figure 2A] 3 is a flowchart of an encoding method and a decoding method according to an embodiment of the present invention. [Figure 2B] 3 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 one embodiment of the present invention. [Figure 3B] FIG. 2 is a schematic diagram of a slice according to one 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] 2 is a hardware structural diagram of an encoding device according to an embodiment of the present invention; DETAILED DESCRIPTION OF THE INVENTION
[0014] The terms used in the embodiments of the present invention are not intended to limit the present invention but merely to describe particular embodiments. As used in the embodiments and claims of the present invention, the singular forms "a," "the," and "said" are intended to include the plural, unless the context clearly dictates otherwise. The term "and / or" as used herein should be understood to mean any and all possible combinations of one or more of the associated listed items. While the embodiments of the present invention may use terms such as "first," "second," and "third" to describe various pieces of information, it should be understood that such information should not be limited to these terms. These terms are used only to distinguish between pieces of information of the same type. For example, first information may be referred to as second information, and similarly, second information may be referred to as first information, without departing from the scope of the present invention. Furthermore, depending on the context, the word "if" may be interpreted as "when," "when," or "in response to determining."
[0015] In order for those skilled in the art to better understand the technical solution of the present invention, a brief explanation of technical terms is provided below.
[0016] Image_width: A 16-bit unsigned integer representing the width of the luminance component of the image, i.e., the number of horizontal samples. The units of image_width are the number of samples per image line, with the sample in the upper left corner of the visible area aligned with the sample in the upper 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 the image sample, and the value of image_height can be a non-zero integer multiple of 2.
[0018] The relationship between the image real width (real_width) and image real height (real_height): real_width and real_height, and the image boundary is shown in Figure 1A. The solid lines indicate the boundaries of the visible area of the image, and the width and height of the boundaries of the visible area are determined by real_width and real_height, respectively. The dashed lines indicate the boundaries of the image, and the width and height of the boundaries of the image are determined by image_width and image_height, respectively. In the following examples, we will explain using image_width and image_height 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, slice A, slice B, slice C, slice D, slice E, slice F, slice G, slice H, and slice I are taken as examples, and each slice may include multiple coding units. FIGS. 1C-1 to 1C-3 show the structural relationship of three types of slices, where 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): These parameters are set by the encoding side and represent the width and height of a slice, respectively. SliceNumX represents the number of slices in the horizontal direction of the image, and SliceNumY represents the number of slices in the vertical direction of the image, using the coding unit (CU) as a unit. 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 encoder 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, as shown in FIG. 1E, can be used to realize the encoding-side processing flow of an embodiment of the present invention. The schematic diagram of the video decoding framework is similar to FIG. 1E, and therefore will not be described again. The video decoding framework can be used to realize the decoding-side processing flow of an embodiment of the present invention. The video coding framework and the video decoding framework may include, but are not limited to, modules such as intra prediction, motion estimation / motion compensation, a reference image buffer, an in-loop filter, reconstruction, transform, quantization, inverse transform, inverse quantization, and an entropy encoder. On the encoding side, the coding-side processing flow can be realized by the cooperation between these modules. On the decoding side, the decoding-side processing flow can be realized by the cooperation between these modules.
[0025] For example, prediction can be divided into intra prediction and inter prediction. Intra prediction takes into account the existence of very strong spatial correlation between adjacent blocks in an image, and predicts a block that is not currently being coded using surrounding reconstructed pixels as reference pixels. Subsequent coding processing can be performed only on the residual signal (original signal - predicted signal) rather than coding the original 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 coded images, thereby achieving the goal of removing temporal redundancy in video.
[0026] For example, in the video coding process, transforming refers to converting an image described in pixel format in the spatial domain into an image in the transform domain and representing it in the form of transform coefficients. Since most images contain many flat and slowly changing regions, an appropriate transform can convert the dispersed distribution of image energy in the spatial domain into a relatively concentrated distribution in the transform domain, thereby eliminating the frequency domain correlation between signals. In this way, the transform process can effectively compress the bitstream in line with the quantization process.
[0027] For example, entropy coding refers to lossless coding based on the principle of information entropy. It is the final processing module in video coding and compression, converting a series of element symbols representing a video sequence into a binary bitstream 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 bitstream after the original video is compressed. Entropy coding can effectively remove statistical redundancy in these element symbols and is one of the important tools for ensuring the efficiency of video coding and 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, the original input signal is predicted to generate a residual signal, which removes temporal and spatial redundancies. Then, the energy of the residual signal is further concentrated through transformation. Next, 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. Finally, entropy coding is used to encode the non-binary coding information into binary information, which then outputs a binary bitstream after removing the coding redundancy.
[0029] In the video encoding process, an image is divided into several non-overlapping rectangular slices, each containing an integer number of non-overlapping coding blocks. Each slice is coded independently (as shown in FIG. 1F, the coding process involves sequentially passing through modules such as prediction, transform, quantization, and entropy coding to generate a binary bitstream). The bitstreams of each slice are then concatenated to form a final bitstream, which is then sent to the decoding side. Corresponding to the coding side, in the video decoding process, an image is first divided into several rectangular slices corresponding to the coding side. The decoding side receives the bitstream and sequentially decodes each slice (the decoding of each coding block in each slice involves processes such as entropy decoding, inverse quantization, inverse transform, and prediction) to obtain reconstructed pixels for each rectangular slice, which are then concatenated to obtain a reconstructed image.
[0030] 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. To achieve this goal, it is necessary to buffer the bitstreams of all slices of the entire image, 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-latency scenarios.
[0031] In response to the above findings, an embodiment of the present invention designs a bitstream grouping method. Specifically, the encoding side divides each slice into multiple chunks, each of which is composed of a multi-byte bitstream. Then, bitstream interleaving encoding is performed on the chunks of each slice in a slice row. In this way, parallel decoding can be achieved by buffering only a few chunks, significantly reducing the decoding delay and reducing the bitstream buffer size on the decoding side. For example, for each slice, the slice can be divided into multiple chunks, and the encoding side can interleave all 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 decode the chunks. In this way, the decoding side can decode multiple slices in parallel without buffering all bitstreams, saving storage resources and enabling parallel decoding even in low-latency scenarios.
[0032] The encoding method and decoding method according to the embodiment 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 set 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 number of transmission bits indicates the length of all chunks, and the chunk size value indicates the length of one chunk, so the number of chunks can be determined based on the target number of transmission bits 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 a 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 a chunk is determined based on slice_width, the number of chunks may be determined based on slice_height. For example, if the length of a chunk is slice_width, the number of chunks may be slice_height; if the length of a chunk is slice_width / 2, the number of chunks may be 2*slice_height; and if the length of a 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 a limitation on 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 for each slice row is the same, the processing process for one slice row will be taken as an example below.
[0041] For example, X slices in the slice row may be coded to obtain X corresponding bitstream buffers. As shown in FIG. 1B , the first slice row is coded first, that is, slices A, B, and C are coded 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, the encoding of the second slice row is performed, i.e., slices D, E, and F are encoded. For example, slices D, E, and F are encoded 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, the encoding of the third slice row is performed, that is, slice G, slice H, and slice I are encoded. For example, slice G, slice H, and slice I are encoded 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] For example, 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, 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 can be obtained. 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] The Z chunks corresponding to bitstream buffer A1 have chunks of at least two different sizes, the Z chunks corresponding to bitstream buffer B1 have chunks of at least two different sizes, and the Z chunks corresponding to bitstream buffer C1 have chunks of at least two different sizes.
[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, chunk A11 corresponding to slice A is added to the current bitstream, then chunk B11 corresponding to slice B is added to the current bitstream, then chunk C11 corresponding to slice C is added to the current bitstream, then chunk A12 corresponding to slice A is added to the current bitstream, then chunk B12 corresponding to slice B is added to the current bitstream, then chunk C12 corresponding to slice C is added 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, but not with another chunk 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 must be added to the target bitstream. For example, before the last chunk of slice A is added to the target bitstream, the chunk of slice B must 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 must be added to the target bitstream.
[0051] In one possible embodiment, one chunk (which may be at least two chunks in actual applications and is not limited to this embodiment, but one chunk is used as an example in this embodiment) corresponding to each of the X slices in the same slice row is sequentially added to the current bitstream based on the horizontal order of the X slices in the slice row, and it is determined whether all chunks have been added to the current bitstream. If all chunks have been added to the current bitstream, the addition of chunks is stopped, and the current bitstream is set as the target bitstream. If not, the process returns to the operation of sequentially adding one chunk corresponding to each of the X slices to the current bitstream based on the horizontal order of the X slices in the slice row.
[0052] For example, for slices A, B, and C arranged sequentially 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 added sequentially 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, the addition of chunks is stopped, i.e., the processing of the current slice row is completed, and the current bitstream of the current slice row is obtained 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 processing of the current slice row and obtaining the target bitstream.
[0054] In one possible embodiment, when chunks corresponding to X slices have been obtained, start interleaving the chunks corresponding to X slices to obtain a target bitstream, where obtaining chunks corresponding to X slices 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.
[0055] For example, after the encoding of the first slice row is completed, 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 are obtained, and chunk A11 is divided from bitstream buffer A1, chunk B11 is divided from bitstream buffer B1, and chunk C11 is divided from bitstream buffer C1. Next, chunk A12 is divided from bitstream buffer A1, chunk B12 is divided from bitstream buffer B1, and chunk C12 is divided from bitstream buffer C1. Then, chunk A13 is divided from bitstream buffer A1, chunk B13 is divided from bitstream buffer B1, and chunk C13 is divided 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. Alternatively, 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. Alternatively, 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 greater than or equal to 1 and 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, which may be applied to a decoding side (for example, a video decoder) and may include the following steps:
[0059] In step 221, 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. 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 set 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 Y slice rows corresponding to the target image, chunks corresponding to X slices in the horizontal direction of the same slice row in the target bitstream are deinterleaved to obtain Z chunks corresponding to each slice. Here, the Z chunks include chunks of at least two different sizes. For example, the decoding side can receive a target bitstream from the encoding side including chunks of X slices in the horizontal direction of the same slice row, and the decoding side can deinterleave chunks corresponding to X slices in the horizontal direction of the same slice row in the target bitstream to obtain Z chunks corresponding to each slice. Because the processing process for each slice row is the same, the processing process for one slice row will be taken as an example below.
[0065] For 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, until Z chunks corresponding to each slice are obtained.
[0066] Obviously, before parsing the last chunk of one slice from the target bitstream, you need to parse the chunk of another slice from the target bitstream. For example, before parsing the last chunk of slice A, you need to parse the chunk of slice B, and before parsing the last chunk of slice B, you need to parse the chunk of slice A.
[0067] In one possible embodiment, one chunk (which may be at least two chunks in actual applications and is not limited to this embodiment, but is illustrated as one chunk in this embodiment) corresponding to each slice is sequentially parsed into the bitstream buffer corresponding to the slice based on the horizontal order of the X slices in the same slice row, and it is determined whether all chunks have been parsed. If it is determined that all chunks of the X slices have been parsed, the deinterleaving of the X slices is completed, and all Z chunks corresponding to each slice are obtained. If it is determined that all chunks of the X slices have not been parsed, the process returns to the operation of sequentially parsing one chunk corresponding to each slice into the bitstream buffer corresponding to the slice based on the horizontal order of the X slices in the same slice row.
[0068] For example, for slices A, B, and C arranged sequentially in the horizontal direction, one chunk A11 corresponding to slice A is parsed into the bitstream buffer A1 corresponding to slice A, one chunk B11 corresponding to slice B is parsed into the bitstream buffer B1 corresponding to slice B, and one chunk C11 corresponding to slice C is parsed into the bitstream buffer C1 corresponding to slice C, and it is determined whether all chunks of slices A, B, and C have been parsed. If all chunks have been parsed, deinterleaving of X slices is completed, and all Z chunks corresponding to each slice are obtained. If not, one chunk corresponding to slice A is parsed into the bitstream buffer A1, one chunk corresponding to slice B is parsed into the bitstream buffer B1, and one chunk corresponding to slice C is parsed into the bitstream buffer C1. This process is repeated until all chunks have been parsed, and in this manner, deinterleaving of X slices is completed, and all Z chunks corresponding to each slice are obtained.
[0069] As a result of the above, Z chunks corresponding to slice A can be obtained, and among the Z chunks, there are chunks of at least two different sizes; Z chunks corresponding to slice B can be obtained, and among the Z chunks, there are chunks of at least two different sizes; and Z chunks corresponding to slice C can be obtained, and among the Z chunks, there are chunks of at least two different sizes.
[0070] In step 224, for the 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, a bitstream buffer A1 corresponding to slice A may include chunks A11, A12, A13, ... corresponding to slice A, a bitstream buffer B1 corresponding to slice B may include chunks B11, B12, B13, ... corresponding to slice B, and a 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 this decoding process is not limited. 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 this process is repeated until the decoding process for all chunks of X slices in the horizontal direction is completed.
[0072] In one possible embodiment, if chunks corresponding to X slices exist in the bitstream buffer corresponding to X slices, start decoding chunks 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, the existence of T chunks corresponding to the slice in the bitstream buffer corresponding to the slice, where T is greater than or equal to 1 and 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 chunks corresponding to X slices. In practical application, after deinterleaving the last group of chunks, X slices may be decoded based on the bitstream buffer corresponding to X slices in the horizontal direction.
[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, the decoding side 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, the decoding side 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 the chunks interleaved by the encoding side is the same each time, and the size of the chunks deinterleaved by the decoding side is the same each time. For example, chunks A11, B11, and C11 are the same size, and chunks A12, B12, and C12 are also the same size. However, the size of chunk A11 may be the same as or different from the size of chunk A12. For the dimensional relationship between different chunks, please refer to the following examples.
[0076] Based on this, if chunk A11, chunk B11, and chunk C11 exist in these bitstream buffers, decoding of these chunks may be started. Alternatively, if chunk A11, chunk B11, chunk C11, chunk A12, chunk B12, and chunk C12 exist in these bitstream buffers, decoding of these chunks may be started. Alternatively, 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, decoding of these chunks may be started. Obviously, if T chunks exist in the bitstream buffers corresponding to each slice, decoding of X slices may be started based on the bitstream buffers corresponding to X slices in the horizontal direction. T is greater than or equal to 1 and less than the number of chunks.
[0077] In one possible embodiment, the chunks of at least two sizes may be of the following types:
[0078] Case 1: 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.
[0079] On 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 the target number of transmission bits, the chunk size value, and the number of chunks.
[0080] Case 2: When the actual number of 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] On 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 encoding bits is constant, for Z chunks, the chunk set includes the remaining chunks except the k-th chunk, and the lengths of all odd-numbered chunks in the chunk set are the first size, all even-numbered chunks are the second size, and the length of the k-th chunk is the third size.
[0083] On 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 actual number of encoding 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 the first size, the lengths of all even-numbered chunks are the second size, and the length of the kth chunk is the 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 encoding bits is constant, for Z chunks, the lengths of all odd-numbered chunks are the first size, and the lengths of all even-numbered chunks are the second size.
[0087] On 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 encoding bits is constant, for Z chunks, the lengths of all odd-numbered chunks are the first size, and the lengths of all even-numbered chunks are the second size.
[0089] On 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, and the number of pixels in the slice row is determined based on the slice width and bits per pixel.
[0090] Case 7: When the actual number of encoding 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 for indicating 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 chunk length indicator information. For example, the target bitstream may include chunk length indicator information for indicating the second size, and the decoding side may parse the chunk length indicator information from the target bitstream and determine the second size based on the slice length indicator information.
[0093] Case 8: When the actual number of encoding 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 bits per pixel, and the second size is determined based on the actual number of encoding 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 for indicating 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 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.
[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 number of transmission bits, 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 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 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. 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 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.
[0102] In the above cases 1 to 4 and 7 to 10, 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. Also, the k-th chunk in different cases is irrelevant, and here, k-th chunk 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, if different, is irrelevant, and here the first size 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, if different, is irrelevant, and here the second size 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 all slices is the same, thereby ensuring parallel decoding.
[0105] As can be seen from the above technical solution, in an 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 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, thereby saving storage resources and meeting 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, and 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 chunks A1 and B1 from the target bitstream, buffers chunk A1 in the bitstream buffer for slice A, buffers chunk B1 in the bitstream buffer for slice B, deinterleaves chunks A2 and B2 from the target bitstream, buffers chunk A2 in the bitstream buffer for slice A, and buffers chunk B2 in the bitstream buffer for slice B, etc. In this way, after chunk A1 and chunk B1 are buffered in their corresponding bitstream buffers, chunk A1 and chunk B1 can be decoded in parallel without waiting for subsequent chunk A2 and chunk B2 to be buffered in their corresponding 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 corresponding bitstream buffers, thereby saving storage resources. Example 2:
[0107] In an embodiment of the present invention, an encoding method applicable to the 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 all slices is interleaved each time to form a bitstream. Since each slice has ChunkNum chunks, 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 have been obtained, interleaving of chunks corresponding to all SliceNumX slices is started 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 greater than or equal to 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 completed, 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 the SliceNumX slices in each slice row sequentially ChunkNum times, and parse the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0120] Illustratively, 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., it is possible 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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. The number of chunks in all slices is the same on the encoding side and the decoding side, thereby ensuring parallel decoding. The size of the chunks does not have to 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. The encoding side may perform zero padding and byte alignment for each slice so that the chunk sizes of each slice are consistent.
[0128] For example, if one slice row contains two slices, 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, if 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 for each slice is constant, e.g., the actual number of coding bits for 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 number of transmission bits, which can be written as total_resource), and determine the number of chunks ChunkNum based on the total resource. Specifically, please refer to the relevant description of the decoding side in this embodiment below, and the description will be 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[0136] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0137] For example, the calculation method of the length of 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 the SliceNumX slices are interleaved each time to form a bitstream.
[0139] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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] For example, a schematic diagram of chunk interleaving when SliceNumX is 2 is shown in FIG. 4A. For example, let's assume that there are N ChunkNum 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 encode chunk N of the first slice, then encode chunk N of the second slice. As shown in FIG. 4B, the lengths of chunks 1 to (N-1) are all 1, and the length of chunk N is 2.
[0142] A schematic diagram of chunk interleaving when SliceNumX is 3 is shown in FIG. 4C. For example, let's assume that there are N chunks with ChunkNum. 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 encode chunk N of the first slice, then encode chunk N of the second slice, then encode chunk N of the third slice. As shown in FIG. 4D, the lengths of chunks 1 to (N-1) are all 1, and the length of chunk N is 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 indicates the length of the bitstream additionally buffered in the bitstream buffer. Clearly, 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 (such as 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0152] For example, each slice can be analyzed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks can 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 can be determined based on the chunk size value, and size2 can 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 for each slice is constant, e.g., the actual number of coding bits for each slice is equal to the target number of transmission bits, 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.
[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 (i.e., the target number of transmission bits), and determine the number of chunks (ChunkNum) based on the total resource. For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[0163] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0164] For example, the calculation method of the length of 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 sequentially coded ChunkNum times, and chunks of the SliceNumX slices are interleaved each time to form a bitstream.
[0166] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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] For example, a schematic diagram of chunk interleaving when SliceNumX is 2 is shown in Figure 5A, where ChunkNum chunks are N chunks. First, chunk 1 of the first slice is encoded, then chunk 1 of the second slice, then chunk 2 of the first slice, then chunk 2 of the second slice, and so on until chunk N of the first slice is encoded, then chunk N of the second slice. As shown in Figure 5B, the length of chunk 1 is size 1, and the lengths of chunks 2 to N are all size 2.
[0169] For example, when SliceNumX is 3, the interleaving process for chunks 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 through 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. The following formula may be adopted for the value of n: 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0177] For example, each slice can be analyzed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks can 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 can be determined based on the chunk size value, and size1 can 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 for each slice is constant. For example, the actual number of coding bits for 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 and last chunks 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 (i.e., the target number of transmission bits), and determine the number of chunks (ChunkNum) based on 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[0188] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0189] For example, the calculation method of the length of 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 the SliceNumX slices are interleaved each time to form a bitstream.
[0191] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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 used 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0200] For example, each slice can be analyzed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks can 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 can be determined based on the chunk size value, and size1 can 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 for each slice is constant. For example, the actual number of coding bits for 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 and last chunks 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 (i.e., the target number of transmission bits) and determine the number of chunks (ChunkNum) based on the slice height (slice_height). For details, please refer to the relevant description of the decoding side in this 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[0211] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0212] For example, the calculation method of the length of 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 the SliceNumX slices are interleaved each time to form a bitstream.
[0214] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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 (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.
[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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0222] For example, each slice may be analyzed 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 resources, 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 for each slice is constant. For example, the actual number of coding bits for 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 depending on whether the chunks are odd-numbered or even-numbered. The lengths of all odd-numbered chunks are the first size, and the lengths of all even-numbered chunks are 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 (i.e., the target number of transmission bits), and determine the number of chunks (ChunkNum) based on the total resource. For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[0233] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0234] For example, the calculation method of the length of 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 the SliceNumX slices are interleaved each time to form a bitstream.
[0236] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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] For example, 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. 6A , the lengths of odd-numbered chunks, such as chunk 1, chunk 3, chunk 5, etc., of each slice are size 1, the lengths of even-numbered chunks, such as chunk 2, chunk 4, chunk 6, etc., of each slice are 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 used 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0246] For example, each slice can be analyzed 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 for each slice is constant, e.g., the actual number of coding bits for each slice is equal to the target number of transmission bits, the lengths of the subsequent ChunkNum-1 chunks are switched between two fixed values depending on whether the chunks are odd-numbered or even-numbered (e.g., 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 (i.e., the target number of transmission bits), and determine the number of chunks (ChunkNum) based on the total resource. For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[0258] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0259] For example, the calculation method of the length of 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 sequentially coded ChunkNum times, and chunks of the SliceNumX slices are interleaved each time to form a bitstream.
[0261] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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] For example, 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 among 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 used 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0271] For example, each slice can be analyzed 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 sequentially switched between two fixed values, size2 and size3. 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 coding bits for each slice is constant. For example, the actual number of coding bits for 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 depending on whether the chunks are odd-numbered or even-numbered (for example, the lengths of all odd-numbered chunks are the first size, and the lengths of all even-numbered chunks are the second size), but the length of the k-th chunk is not constant but 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 and last chunks 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 (i.e., the target number of transmission bits), and determine the number of chunks (ChunkNum) based on the total resource. For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[0283] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0284] For example, the calculation method of the length of 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 sequentially coded ChunkNum times, and chunks of the SliceNumX slices are interleaved each time to form a bitstream.
[0286] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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 used 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0295] For example, each slice can be analyzed 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 sequentially switched between two fixed values, size2 and size3. 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] where x is a preset value. The odd-numbered chunks are the odd-numbered chunks among the remaining ChunkNum-1 chunks, and the even-numbered chunks are the even-numbered chunks 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 coding bits for each slice is constant. For example, the actual number of coding bits for 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 depending on whether the chunks are odd-numbered or even-numbered (for example, the lengths of all odd-numbered chunks are the first size, and the lengths of all even-numbered chunks are the second size), but the length of the k-th chunk is not constant but 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 and last chunks 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 (i.e., the target number of transmission bits) and determine the number of chunks (ChunkNum) based on the slice height (slice_height). For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[0307] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0308] For example, the calculation method of the length of 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 the SliceNumX slices are interleaved each time to form a bitstream.
[0310] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0318] For example, each slice can be analyzed ChunkNum times to obtain ChunkNum chunks. 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 sequentially switched between two fixed values, size2 and size3. The value of k ranges from 1 to ChunkNum. 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 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] where x is a preset value. The odd chunks are the odd chunks among the remaining ChunkNum-1 chunks, and the even chunks are the even chunks 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 coding bits for each slice is constant. The actual number of coding 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 performing zero padding and byte alignment on the bitstream buffer, the length of all chunks is switched between two fixed values depending on whether the chunks are odd or even (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 sum of the lengths of the chunks of the first size and the sum of the lengths 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 (i.e., the target number of transmission bits), and determine the number of chunks (ChunkNum) based on the total resource. For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be 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 each slice row has SliceNumX slices, the SliceNumX slices are coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero-filling and byte alignment may be performed so that the actual number of coded bits is equal to 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-filling 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 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 sequentially coded ChunkNum times, and chunks of the SliceNumX slices are interleaved each time to form a bitstream.
[0333] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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, 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. 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 eleventh embodiment, 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0343] For example, each slice can be analyzed 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 performs zero padding and byte alignment based on the length of every chunk, so the length of every chunk is 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 Examples 3 to 10, 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 requires zero-padding is 20. In Example 11, 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 size1s and two size2s. Therefore, when zero-padding and byte alignment are performed on the bitstream buffer, the length of the bitstream buffer needs to increase from 340 to 400, that is, the length that requires zero-padding is 60. As a result, the lengths of all chunks are 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 coding bits for each slice is constant. The actual number of coding 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 performing zero padding and byte alignment on the bitstream buffer, the length of all chunks is switched between two fixed values depending on whether the chunks are odd or even (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 sum of the lengths of the chunks of the first size and the sum of the lengths 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 (i.e., the target number of transmission bits) and determine the number of chunks (ChunkNum) based on the slice height (slice_height). For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be 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, SliceNumX slices can be coded to obtain SliceNumX bitstream buffers corresponding to the SliceNumX slices. For each bitstream buffer, zero-filling and byte alignment may be performed 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 number of transmission bits. That is, zero-filling 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 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 the SliceNumX slices are interleaved each time to form a bitstream.
[0359] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0367] For example, each slice can be analyzed ChunkNum times to obtain ChunkNum chunks, and the length of each ChunkNum chunk is calculated by sequentially switching the length of each ChunkNum chunk between two fixed values, size1 and size2. For example, the length of each odd-numbered chunk is size1, and the length of each even-numbered chunk is size2, or the length of each odd-numbered chunk is size2, and the length of each even-numbered chunk 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] where 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 sequentially.
[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, that is, the sum of the lengths of two size1s and two size2s. Therefore, when zero-padding and byte-aligning the bitstream buffer, the length of the bitstream buffer needs to be changed from 340 to 400, that is, the length that needs to be zero-padding 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 for each slice is the actual number of coded bits, not the target number of transmission bits; that is, no zero-padding or 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 coded bits in the bitstream buffer is 340, and no additional zero-padding is required. The length of the previous ChunkNum-1 chunks is constant and is designated as the first size, while the length of the last chunk is variable and is designated as the second size. In addition, the bitstream must include chunk length indicator information corresponding to the last chunk, which is used to indicate the length of the last chunk, i.e., 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 (i.e., the target number of transmission bits), and determine the number of chunks (ChunkNum) based on the total resource. For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be omitted here.
[0378] In step 3, the SliceNumX slices in each slice row are coded sequentially to generate SliceNumX bitstream buffers, and the actual number of coding bits real_bit corresponding to each bitstream buffer is calculated.
[0379] For example, since each slice row has SliceNumX slices, 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. Alternatively, the actual number of coded bits corresponding to each bitstream buffer, real_bit, 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 the SliceNumX slices are interleaved each time to form a bitstream.
[0383] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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] For example, before encoding the last chunk, chunk header information (also referred to as chunk length indication information) for indicating the length of the last chunk, i.e., the value of size2, may be encoded in the bitstream. For example, the chunk header information may be encoded using a fixed number of bits, e.g., 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 is as follows: first, chunk 1 of the first slice is encoded, then chunk 1 of the second slice is encoded, then chunk 2 of the first slice is encoded, then chunk 2 of the second slice is encoded, 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 is encoded, then chunk N of the first slice is encoded, then chunk header information 2 of chunk N of the second slice indicating the length of chunk N of the second slice is encoded, and then chunk N of the second slice is encoded. As shown in Figure 7A, 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 (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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0394] For example, before parsing the last chunk from the bitstream, chunk header information of the chunk may be parsed first, where the chunk header information indicates 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, the 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. Then, the 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 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 it is not limited thereto, where T is 1 or more and T is smaller than the number of chunks.
[0398] In step 5, after the decoding of each slice is completed, the 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, 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 14:
[0400] The length of the bitstream buffer for each slice is the actual number of coded bits, not the target number of transmission bits; i.e., the bitstream buffer is not zero-filled or byte-aligned. The following ChunkNum-1 chunks have a fixed length and are designated as a first size, while the length of the first chunk is not fixed but is designated as a second size. The bitstream must also include chunk length indicator information corresponding to the first chunk, which 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 (i.e., the target number of transmission bits), and determine the number of chunks (ChunkNum) based on the total resource. For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be omitted here.
[0404] In step 3, the SliceNumX slices in each slice row are coded sequentially to generate SliceNumX bitstream buffers, and the actual number of coding 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 coded and SliceNumX bitstream buffers corresponding to the SliceNumX slices are obtained. After the SliceNumX bitstream buffers are obtained, 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 coding 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 such that the length of the first chunk is size1 and the length of the subsequent 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 the SliceNumX slices are interleaved each time to form a bitstream.
[0409] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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] For example, before encoding the first chunk, chunk header information (also referred to as chunk length indication information) for indicating the length of the first chunk, i.e., the value of size 1, may be encoded in the bitstream. For example, the chunk header information may be encoded using a fixed number of bits, e.g., a fixed 16-bit number.
[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] For example, when SliceNumX is 2, chunk interleaving 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 repeating in this manner 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0420] For example, 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 analyzed from the bitstream. For example, first, the chunk header information of the first chunk of the first slice is analyzed from the bitstream, and the first chunk of the first slice is analyzed based on the chunk header information. Then, the chunk header information of the first chunk of the second slice is analyzed from the bitstream, and the first chunk of the second slice is analyzed based on the chunk header information.
[0422] Exemplarily, for each slice, it is possible to perform ChunkNum analyses 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 fact that there are 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 smaller than the number of chunks.
[0425] In step 5, after the decoding of each slice is completed, a 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 coded 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 defined as a first size, while the length of the k-th chunk is not constant and is defined as a second size. The bitstream must also include chunk length indicator information corresponding to the k-th chunk, which is used to indicate the length of the k-th chunk. The k-th chunk may be the last chunk of all chunks, the first chunk of all chunks, or any chunk between the first and last chunks of all 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 (i.e., the target number of transmission bits), and determine the number of chunks (ChunkNum) based on the total resource. For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be omitted here.
[0431] In step 3, the SliceNumX slices in each slice row are coded sequentially to generate SliceNumX bitstream buffers, and the actual number of coding 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 coded and SliceNumX bitstream buffers corresponding to the SliceNumX slices are obtained. After the SliceNumX bitstream buffers are obtained, 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.
[0433] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0434] For example, 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 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 the SliceNumX slices are interleaved each time to form a bitstream.
[0436] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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 referred to as chunk length indication information) for indicating the length of the k-th chunk, i.e., the value of size1, may be encoded in the bitstream. For example, the chunk header information may be encoded using a fixed number of bits, e.g., a fixed 16-bit encoding.
[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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0446] For example, before parsing the k-th chunk from the bitstream, the chunk header information of the chunk may be parsed first, and 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 analyzed from the bitstream based on the value indicated by the chunk header information. For example, first, the chunk header information of the k-th chunk of the first slice is analyzed from the bitstream, and the k-th chunk of the first slice is analyzed based on the chunk header information, and then the chunk header information of the k-th chunk of the second slice is analyzed from the bitstream, and the k-th chunk of the second slice is analyzed 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 the presence of T chunks corresponding to each slice in the bitstream buffer corresponding to that slice, but is not limited thereto, 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, a 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, 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 16:
[0453] The length of the bitstream buffer for each slice is the actual number of coded 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 defined as a first size, while the length of the k-th chunk is not constant and is defined as a second size. The bitstream must also include chunk length indicator information corresponding to the k-th chunk, which is used to indicate the length of the k-th chunk. The k-th chunk may be the last chunk of all chunks, the first chunk of all chunks, or any chunk between the first and last chunks of all 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 (i.e., the target number of transmission bits) and determine the number of chunks (ChunkNum) based on the slice height (slice_height). For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be omitted here.
[0457] In step 3, the SliceNumX slices in each slice row are coded sequentially to generate SliceNumX bitstream buffers, and the actual number of coding 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 coded and SliceNumX bitstream buffers corresponding to the SliceNumX slices are obtained. After the SliceNumX bitstream buffers are obtained, 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.
[0459] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0460] For example, 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 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 sequentially coded ChunkNum times, and chunks of the SliceNumX slices are interleaved each time to form a bitstream.
[0462] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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 referred to as chunk length indication information) for indicating the length of the k-th chunk, i.e., the value of size1, may be encoded in the bitstream. For example, the chunk header information may be encoded using a fixed number of bits, e.g., a fixed 16-bit encoding.
[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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0471] For example, before parsing the k-th chunk from the bitstream, the chunk header information of the chunk may be parsed first, and 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 analyzed from the bitstream based on the value indicated by the chunk header information. For example, first, the chunk header information of the k-th chunk of the first slice is analyzed from the bitstream, and the k-th chunk of the first slice is analyzed based on the chunk header information, and then the chunk header information of the k-th chunk of the second slice is analyzed from the bitstream, and the k-th chunk of the second slice is analyzed based on the chunk header information.
[0473] For example, each slice can be analyzed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks can 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 the 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 for each slice is constant. For example, the actual number of coding bits for 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. In addition, the bitstream needs to include chunk length indicator information corresponding to the last chunk, and the chunk length indicator 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 (i.e., the target number of transmission bits), and determine the number of chunks (ChunkNum) based on the total resource. For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[0484] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0485] 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 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 sequentially coded ChunkNum times, and chunks of the SliceNumX slices are interleaved each time to form a bitstream.
[0487] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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] For example, before encoding the last chunk, chunk header information (also called chunk length indication information) for indicating the length of the last chunk, i.e., the value of size2, may be encoded in the bitstream. 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] For example, 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 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, and the length of chunk N in the first slice is not constant and is indicated by the chunk N header information of the first slice.The length of chunk N in the second slice is also not constant and 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 used 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0498] For example, before parsing the last chunk from the bitstream, chunk header information of the chunk may be parsed first, where the chunk header information indicates 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, the 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. Then, the 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 presence 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 for each slice is constant. For example, the actual number of coding bits for each slice is equal to the target number of transmission bits, the lengths of the subsequent ChunkNum-1 chunks are constant and are designated as a first size, and the length of the first chunk is not constant and is designated as a second size. In addition, the bitstream must include chunk length indicator information corresponding to the first chunk, and the chunk length indicator 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 (i.e., the target number of transmission bits), and determine the number of chunks (ChunkNum) based on the total resource. For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[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 sequentially coded ChunkNum times, and chunks of the SliceNumX slices are interleaved each time to form a bitstream.
[0513] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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] For example, before encoding the first chunk, chunk header information (also called chunk length indication information) for indicating the length of the first chunk, i.e., the value of size 1, may be encoded in the bitstream. 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] For 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 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 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 used 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0524] For example, before parsing the first 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 first chunk. The chunk header information may be parsed using a fixed number of bits, for example, 16 bits. The first chunk from the bitstream is parsed based on the value indicated by the chunk header information. For example, first, the chunk header information of the first chunk of the first slice from the bitstream is parsed, and the first chunk of the first slice is parsed based on the chunk header information. Thereafter, the chunk header information of the first chunk of the second slice from the bitstream is parsed, 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 bit - stream buffer of each slice.
[0527] In a possible embodiment, if there are chunks in the bit - stream buffer corresponding to SliceNumX slices, the decoding of the chunks corresponding to the SliceNumX slices is started. Here, the fact that there are chunks in the bit - stream buffer corresponding to the SliceNumX slices may include that for each slice, there are T chunks corresponding to the slice in the bit - stream 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.
[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 or not the analysis of the bit - stream 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 for each slice is constant. For example, the actual number of coding bits for 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 constant and are defined as a first size, while the length of the k-th chunk is not constant and is defined as a second size. In addition, the bitstream must include chunk length indicator information corresponding to the k-th chunk, and the chunk length indicator 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 and last chunks of all the 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 (i.e., the target number of transmission bits), and determine the number of chunks (ChunkNum) based on the total resource. For details, please refer to the relevant description of the decoding side in this embodiment below, and the description will be 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[0536] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0537] 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. 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))
[0538] In step 5, the SliceNumX slices in one slice row are sequentially coded ChunkNum times, and chunks of the SliceNumX slices are interleaved each time to form a bitstream.
[0539] Exemplarily, before encoding the k-th chunk, chunk header information (also referred to as chunk length indication information) for indicating the length of the k-th chunk, i.e., the value of size1, may be encoded in the bitstream. For example, the chunk header information may be encoded using a fixed number of bits, e.g., a fixed 16-bit encoding.
[0540] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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 of each slice row, analyze it sequentially ChunkNum times, and analyze SliceNumX chunks each time to deinterleave 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, it may be analyzed with 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 can be analyzed ChunkNum times to obtain ChunkNum chunks. The calculation method for the lengths of the ChunkNum chunks is 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.
[0551] In step 4, decode each slice based on the bitstream buffer of each slice.
[0552] In one possible embodiment, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 for each slice is constant. For example, the actual number of coding bits for 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 constant and are defined as a first size, while the length of the k-th chunk is not constant and is defined as a second size. In addition, the bitstream must include chunk length indicator information corresponding to the k-th chunk, and the chunk length indicator 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 and last chunks of all the chunks.
[0556] In the twentieth embodiment, 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 (i.e., the target number of transmission bits) and determine the number of chunks (ChunkNum) based on the slice height (slice_height). For details, please refer to the relevant description of the decoding side in this 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[0561] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0562] For example, 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 resources, 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 sequentially coded ChunkNum times, and chunks of the SliceNumX slices are interleaved each time to form a bitstream.
[0564] Exemplarily, before encoding the k-th chunk, chunk header information (also referred to as chunk length indication information) for indicating the length of the k-th chunk, i.e., the value of size1, may be encoded in the bitstream. For example, the chunk header information may be encoded using a fixed number of bits, e.g., a fixed 16-bit encoding.
[0565] In one possible embodiment, when chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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 twentieth embodiment, 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0573] For example, 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. The k-th chunk is parsed from the bitstream based on the value indicated by the chunk header information.
[0574] For example, each slice can be analyzed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks can 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 the 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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 for each slice is constant. For example, the actual number of coding bits for 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 constant and are defined as a first size, while the length of the k-th chunk is not constant and is defined as a second size. In addition, the bitstream must include chunk length indicator information corresponding to the k-th chunk, and the chunk length indicator 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 and last chunks of all the 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 (i.e., the target number of transmission bits) and determine the number of chunks (ChunkNum) based on the slice height (slice_height). For details, please refer to the relevant description of the decoding side in this 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-filling and byte alignment may be performed so that the length of the bitstream buffer is equal to the target number of transmission bits. That is, zero-filling and byte alignment are performed on the bitstream buffer based on the target number of transmission bits.
[0585] In step 4, each bitstream buffer is divided into ChunkNum chunks.
[0586] 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. 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)<<3)>>3) size1=total_resource-((Chunk Num-1)*size2)
[0587] The calculation formula for size2 in Example 21 is different from that in Example 20. 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, while 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 sequentially coded ChunkNum times, and chunks of the SliceNumX slices are interleaved each time to form a bitstream.
[0589] For example, before encoding the k-th chunk, chunk header information (also called chunk length indication information) for indicating the length of the k-th chunk, i.e., the value of size1, may be encoded in the bitstream. 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 chunks corresponding to all slices in a slice row have been obtained, start interleaving chunks corresponding to all SliceNumX slices to obtain a bitstream, where obtaining 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 the SliceNumX chunks each time and deinterleave them into the bitstream buffer of each slice.
[0598] For example, 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. The k-th chunk is parsed from the bitstream based on the value indicated by the chunk header information.
[0599] For example, each slice can be analyzed ChunkNum times to obtain ChunkNum chunks, and the length of the ChunkNum chunks can 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 the 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, if chunks exist in the bitstream buffer corresponding to the SliceNumX slices, start decoding the chunks corresponding to the SliceNumX slices, where the existence of chunks in the bitstream buffer corresponding to the SliceNumX slices may include, but is not limited to, for each slice, the existence of 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-described embodiments may be implemented alone or in combination. For example, each of the embodiments 1 to 21 may be implemented alone, or at least two of the embodiments 1 to 21 may be implemented in combination. The explanation of the parameters in each of the above-described embodiments can also be applied to the other embodiments. For example, the explanation of embodiment 1 can be applied to embodiments 2 to 21, and the explanation of embodiment 3 can be applied to embodiments 4 to 21.
[0605] In each of the above embodiments, the content on the encoding side may be applied to the decoding side, and the content on the decoding side may be applied to the encoding side. Example 22:
[0606] Based on the same idea as 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 the above embodiments 1 to 21.
[0607] For example, in one possible embodiment, the decoder is configured to divide a target image into X*Y slices, where X represents the number of slices in the horizontal direction of the target image, Y represents the number of slices in the 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; determine a number Z of chunks in each slice, where Z represents the number of chunks included in each slice; for each of the Y slice rows corresponding to the target image, deinterleaving chunks corresponding to the 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 the bitstream buffer corresponding to each slice includes the chunks corresponding to the slice.
[0608] Based on the same idea as the above method, an embodiment of the present invention further provides an encoding device to be 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 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, Y represents the number of slices in a vertical direction of the to-be-processed image, X is a positive integer greater than 1, and Y is a positive integer greater than or equal to 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 transmit the target bitstream to a decoding side, wherein 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 the 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 Figure 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 the hardware architecture of an encoding device (also called a video encoder) according to an embodiment of the present invention, as shown in Figure 9B, specifically includes a processor 921 and a machine-readable storage medium 922. Here, 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 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, 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 implement the decoding method or encoding method disclosed in the above example of the present invention.
[0614] Based on a similar idea to the above method, an embodiment of the present invention further provides a decoding device applied to a decoding side, the decoding device including: a segmentation module for segmenting a target image into X*Y slices, where X represents the number of slices in a horizontal direction of the target image and Y represents the number of slices in a vertical direction of the target image, where X is a positive integer greater than 1 and Y is a positive integer greater than 1; a determination module for determining a number Z of chunks in each slice, where 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 chunks 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] For example, the decoding module specifically parses one chunk corresponding to each slice into a bitstream buffer corresponding to the slice based on the horizontal order of the X slices in 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 horizontal order of the X slices in the slice row.
[0617] Exemplarily, the decoding module is specifically configured to start decoding chunks corresponding to the X slices when chunks exist in the bitstream buffer corresponding to the X slices, where the existence of chunks in the bitstream buffer corresponding to the X slices includes, for each slice, the existence of 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.
[0618] Based on a similar idea to the above method, an embodiment of the present invention further provides a coding device applied to an encoding side, the coding device including: a division module for dividing a target image into X*Y slices, where X represents the number of slices in a horizontal direction of the target image and Y represents the number of slices in a vertical direction of the target image, where X is a positive integer greater than 1 and Y is a positive integer greater than 1; a determination module for determining a number Z of chunks in each slice, where Z represents the number of chunks included in each slice; a coding 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, dividing the bitstream buffer into Z chunks for each of the X bitstream buffers, and interleaving the chunks corresponding to the X slices in the horizontal direction of the slice row to obtain a target bitstream, where the Z chunks include chunks of at least two different sizes; 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, stop adding chunks and set the current bitstream as the target bitstream if it is determined that all Z chunks of each slice have been added to the current bitstream, and 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 start interleaving the chunks corresponding to the X slices to obtain a target bitstream when the chunks corresponding to the X slices are obtained, where obtaining the chunks corresponding to the X slices includes, for each slice, obtaining S chunks corresponding to the slice, where S is greater than or equal to 1 and less 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 a similar concept 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, 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 that can contain or store information such as executable instructions, data, etc. For example, the machine-readable storage medium may be a random access memory (RAM), 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 systems, devices, modules, or units described in the above embodiments may be realized by computer chips or entities, or by products having certain functions. A typical realizing device is a computer, and the computer may take the form of a personal computer, a laptop computer, a mobile phone, a camera phone, a smartphone, a personal digital assistant (PDA), a media player, a navigation device, an email sending / receiving device, a game console, a tablet PC, a wearable device, or any combination of these devices.
[0625] For convenience of description, the above device will be described by dividing it 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] Those skilled in the art will appreciate 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 media (including, but not limited to, magnetic disk storage devices, CD-ROMs, optical storage devices, etc.) having computer-usable program code thereon.
[0627] The present invention will be described with reference to flowcharts and / or block diagrams of methods, apparatus (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 implemented 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, when executed by the processor of the general-purpose computer or other programmable data processing device, generate an apparatus for implementing the functions specified in one or more flows of the flowcharts and / or one or more blocks of the block diagrams. Furthermore, these computer program instructions may be stored in a computer-readable memory that can direct 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, which implements the functions specified in one or more flows of the flowcharts and / or one or more blocks of the block diagrams.
[0628] These computer program instructions can be loaded into a computer or other programmable data processing device, and a series of operational steps executed on the computer or other programmable device generates 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 flowcharts and / or one or more blocks of the block diagrams. The above description is merely an example of the present invention and is not intended to limit the present invention. Various changes and modifications can be made by those skilled in the art to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included within the scope of the claims of the present invention.
Claims
1. Dividing an image to be processed into X*Y slices, where X represents the number of slices in the horizontal direction of the image to be processed, Y represents the number of slices in the vertical direction of the image to be processed, X is a positive integer greater than 1, and Y is a positive integer equal to or greater than 1; determining the number Z of chunks in each slice, where Z represents the number of chunks contained in each slice; For each of the Y slice rows corresponding to the image to be processed, 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; decoding the X slices in the horizontal direction of the slice row based on a bitstream buffer corresponding to the X slices; wherein 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; The number of slices X is calculated by the formula: X=(ImageWidth+SliceWidth-1) / SliceWidth, the number of slices Y is calculated by the formula: Y=(ImageHeight+SliceHeight-1) / SliceHeight, where ImageWidth represents the width of the image to be processed and its value is not 0 and is an integer multiple of 16, SliceWidth represents the width of the slice, ImageHeight represents the height of the image to be processed and its value is not 0 and is an integer multiple of 2, and SliceHeight represents the height of the slice. A decoding 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 set chunk size value; 2. The method of claim 1 .
3. 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, 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, and determining whether all Z chunks of each slice have been parsed; If it is determined that all Z chunks of each slice have been analyzed, complete 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 the operation of sequentially parsing one chunk corresponding to each slice into the bitstream buffer corresponding to the slice based on the order of the X slices in the horizontal direction of the slice row; 2. The method of claim 1 .
4. Decoding the X slices based on bitstream buffers corresponding to the X slices in the horizontal direction of the slice row includes: If chunks exist in the bitstream buffer corresponding to the X slices, starting decoding of the chunks 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 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 Z.
2. The method of claim 1 .
5. Among 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 set 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. The k-th chunk is the last chunk of the Z chunks.
6. The method of claim 5.
7. Dividing an image to be processed into X*Y slices, where X represents the number of slices in the horizontal direction of the image to be processed, Y represents the number of slices in the vertical direction of the image to be processed, X is a positive integer greater than 1, and Y is a positive integer equal to or greater than 1; determining the number Z of chunks in each slice, where Z represents the number of chunks contained in each slice; For each of the Y slice rows corresponding to the image to be processed, 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, The number of slices X is calculated by the formula: X=(ImageWidth+SliceWidth-1) / SliceWidth, the number of slices Y is calculated by the formula: Y=(ImageHeight+SliceHeight-1) / SliceHeight, where ImageWidth represents the width of the image to be processed and its value is not 0 and is an integer multiple of 16, SliceWidth represents the width of the slice, ImageHeight represents the height of the image to be processed and its value is not 0 and is an integer multiple of 2, and SliceHeight represents the height of the slice.
10. A coding method comprising:
8. 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 set chunk size value; 8. The method of claim 7.
9. 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 the order of the X slices in the 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 of 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 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; 8. The method of claim 7.
10. 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 acquired, starting interleaving the chunks corresponding to the X slices to obtain a target bitstream; Here, acquiring chunks corresponding to the X slices includes acquiring S chunks corresponding to each of the X slices, where S is equal to or greater than 1 and is less than Z.
8. The method of claim 7.
11. When the number of actual encoding 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 set 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.
8. The method of claim 7.
12. The k-th chunk is the last chunk of the Z chunks.
12. The method of claim 11 .
13. A segmentation module for segmenting a target image into X*Y slices, where X represents the number of slices in the horizontal direction of the target image, and Y represents the number of slices in the vertical direction of the target image, where X is a positive integer greater than 1, and Y is a positive integer equal to or greater than 1, and the number of slices X is calculated by the formula X=(ImageWidth+SliceWidth-1) / SliceWidth, and the number of slices Y is calculated by the formula Y=(I a division module, wherein ImageWidth represents the width of the image to be processed, its value being a non-zero integer multiple of 16, SliceWidth represents the width of the slice, ImageHeight represents the height of the image to be processed, its value being a non-zero integer multiple of 2, and SliceHeight represents the height of the slice; 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 image to be processed, 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 the horizontal direction of the slice row to obtain a target bitstream, wherein the Z chunks include chunks of at least two different sizes; a transmitting module for transmitting the target bitstream to a decoding side; 1. An encoding device comprising:
14. A segmentation module for segmenting a target image into X*Y slices, where X represents the number of slices in the horizontal direction of the target image, and Y represents the number of slices in the vertical direction of the target image, where X is a positive integer greater than 1, and Y is a positive integer equal to or greater than 1, and the number of slices X is calculated by the formula X=(ImageWidth+SliceWidth-1) / SliceWidth, and the number of slices Y is calculated by the formula Y=(I a division module, wherein ImageWidth represents the width of the image to be processed, its value being a non-zero integer multiple of 16, SliceWidth represents the width of the slice, ImageHeight represents the height of the image to be processed, its value being a non-zero integer multiple of 2, and SliceHeight represents the height of the slice; 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 image to be processed, 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; a decoding module for decoding the X slices in the horizontal direction of the slice row based on a bitstream buffer corresponding to the X slices; wherein 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 characterized by:
15. 1. A coding device comprising: a machine-readable storage medium having machine-executable instructions stored thereon; a processor, The processor is adapted to perform the method steps of any one of claims 7 to 12 by executing the machine-executable instructions.
1. An encoding device characterized by:
16. 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 1 to 6. A decoding device characterized by:
17. A machine-readable storage medium having stored thereon computer instructions which, when executed by a processor, cause the processor to implement the method of any one of claims 1 to 12. A machine-readable storage medium comprising:
18. A computer program which, when executed by a processor, implements the method according to any one of claims 1 to 12. A computer program characterized by:
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