Coding and decoding method, apparatus, and device of syntax element, electronic device and storage medium
By optimizing the encoding of the width and height syntax elements in the video coding standard and combining them with unsigned exponential Golomb coding and u(1) coding, the problem of low syntax element coding efficiency is solved and a more efficient coding effect is achieved.
Patent Information
- Application Number
- CN202111389452.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-22
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2041-11-22
AI Technical Summary
There is room for improvement in the coding efficiency of syntax elements in existing video coding standards, especially when the image resolution is large and the number of coding bits consumed is high.
By obtaining the smaller value of the width syntax element and the height syntax element, the absolute value of the difference, and the coded value of the size relationship, these values are encoded in combination with unsigned exponential Golomb coding and u(1) coding to reduce the number of coded bits.
The value of the coded data is significantly reduced, the coding efficiency of the syntax elements is improved, and the number of coding bits is saved, especially when the image resolution is large.
Smart Images

Figure CN116156203B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video coding and decoding technology, and in particular to a method, device, electronic device and storage medium for encoding and decoding syntax elements. Background Art
[0002] In recent years, with increasing user experience demands, providing users with HD and even UHD video has become a trend in video services. Video signals contain enormous amounts of data, requiring significant transmission bandwidth and storage space. Therefore, video signals must be compressed and encoded during transmission and storage, making video compression technology an increasingly essential and critical technology in video applications. Against this backdrop, the International Standards Organization has successively introduced the H.265 / HEVC and H.266 / VVC coding standards, both of which offer higher compression performance. Compared to the previous generation video coding standard, H.264 / AVC, H.265 / HEVC reduces bitrate by over 50% while achieving comparable image quality. Furthermore, the latest H.266 / VVC standard achieves further bitrate savings of over 40% compared to H.265 / HEVC.
[0003] The new coding standard has achieved a higher compression rate than before. However, its efficiency in encoding syntax elements is not high enough, and there is room for improvement. Summary of the Invention
[0004] The main purpose of the embodiments of the present invention is to provide a syntax element encoding and decoding method, apparatus, electronic device and storage medium, so as to improve the encoding and decoding efficiency of syntax elements.
[0005] In order to solve the above problem, an embodiment of the present invention provides a method for encoding a syntax element, including:
[0006] A first coding value is obtained based on the smaller value of the value of the width syntax element and the value of the height syntax element; a second coding value is obtained based on the absolute value of the difference between the value of the width syntax element and the value of the height syntax element; a third coding value is obtained based on the size relationship between the value of the width syntax element and the value of the height syntax element; the first coding value, the second coding value and the third coding value are encoded in sequence; wherein, the first coding value and the second coding value are subjected to unsigned exponential Golomb coding, and the third coding value is subjected to unsigned exponential Golomb coding or u(1) coding.
[0007] An embodiment of the present invention further provides a method for decoding a syntax element, comprising:
[0008] The received code stream is decoded to obtain a first code value, a second code value and a third code value in sequence; wherein the first code value and the second code value are obtained by unsigned exponential Golomb decoding, and the third code value is obtained by unsigned exponential Golomb decoding or u(1) decoding, the first code value represents the smaller value between the value of the width syntax element and the value of the height syntax element, the second code value represents the absolute value of the difference between the value of the width syntax element and the value of the height syntax element, and the third code value represents the size relationship between the value of the width syntax element and the value of the height syntax element; according to the first code value, the second code value and the third code value, the value of the width syntax element and the value of the height syntax element are obtained.
[0009] An embodiment of the present invention also provides a syntax element encoding device, including: a first acquisition module, used to obtain a first encoding value based on the smaller value of the value of the width syntax element and the value of the height syntax element; a second acquisition module, used to obtain a second encoding value based on the absolute value of the difference between the value of the width syntax element and the value of the height syntax element; a third acquisition module, used to obtain a third encoding value based on the size relationship between the value of the width syntax element and the value of the height syntax element; an encoding module, used to encode the first encoding value, the second encoding value and the third encoding value in sequence; wherein, the first encoding value and the second encoding value are subjected to unsigned exponential Golomb coding, and the third encoding value is subjected to unsigned exponential Golomb coding or u(1) coding.
[0010] An embodiment of the present invention further provides a syntax element decoding device, comprising:
[0011] A parsing module is used to decode the received code stream to obtain a first code value, a second code value and a third code value in sequence; wherein the first code value and the second code value are obtained by unsigned exponential Golomb decoding, and the third code value is obtained by unsigned exponential Golomb decoding or u(1) decoding, the first code value represents the smaller value between the value of the width syntax element and the value of the height syntax element, the second code value represents the absolute value of the difference between the value of the width syntax element and the value of the height syntax element, and the third code value represents the size relationship between the value of the width syntax element and the value of the height syntax element; an acquisition module is used to obtain the value of the width syntax element and the value of the height syntax element according to the first code value, the second code value and the third code value.
[0012] An embodiment of the present invention also provides a server, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the above-mentioned method for encoding syntax elements, or to execute the above-mentioned method for decoding syntax elements.
[0013] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program, which implements the above-mentioned syntax element encoding method or the above-mentioned syntax element decoding method when executed by a processor.
[0014] The embodiment of the present invention associates the image width value with the height value, obtains the difference between the image height value and the width value, and sets a third coding value for characterizing the size relationship between the image height value and the width value. Then, the smaller value of the height value and the width value, the difference between the height value and the width value, and the third coding value are encoded, and the larger value of the two is no longer encoded. The difference between the width and the height and the third coding value are both much smaller than the larger value of the two. Compared with the traditional method of encoding the width and height values of the image, the numerical value of the encoded data is significantly reduced. Combined with the characteristic of the unsigned exponential Golomb coding method that the smaller the coding value, the fewer the coding bits, the number of coding bits can be shortened, thereby improving the coding efficiency of the syntax elements. The u(1) coding method has the characteristic of encoding a small number of coding bits for encoding a one-bit unsigned integer. Therefore, the third coding value characterizing the size relationship between the width and the height of the image is encoded using the u(1) coding method, which can further shorten the number of coding bits and improve the coding efficiency of the syntax elements. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] One or more embodiments are exemplarily illustrated by pictures in the corresponding drawings, and these exemplifications do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0016] Figure 1 is a flow chart of a method for encoding syntax elements according to an embodiment of the present invention;
[0017] Figure 2 is a flow chart of a method for decoding syntax elements according to one embodiment of the present invention;
[0018] Figure 3 is a flow chart of a method for decoding syntax elements according to another embodiment of the present invention;
[0019] Figure 4 is a schematic structural diagram of a syntax element encoding apparatus according to an embodiment of the present invention;
[0020] Figure 5 is a schematic structural diagram of a syntax element decoding apparatus according to an embodiment of the present invention;
[0021] Figure 6 FIG. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, each embodiment of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be understood by those skilled in the art that in each embodiment of the present invention, many technical details are provided to enable the reader to better understand the present invention. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present invention can be implemented. The division of the following embodiments is for convenience of description and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other under the premise that there is no contradiction.
[0023] In the field of video compression technology, H.265 / HEVC and H.266 / VVC are currently the most commonly used coding standards. Compared with the previous generation video coding standard H.264 / AVC, H.265 / HEVC can achieve over 50% bitrate reduction while achieving equivalent image quality. Compared with H.265 / HEVC, the latest H.266 / VVC coding standard can further achieve over 40% bitrate reduction.
[0024] The H.265 / HEVC and H.266 / VVC coding standards use unsigned exponential Golomb coding for the width and height syntax elements that represent image resolution information. The unsigned exponential Golomb coding table is shown in Table 1.
[0025] Table 1. Unsigned Exponential Golomb Code Table
[0026] Bit string format Code value range 1 0 <![CDATA[01x0]]> 1-2 <![CDATA[001x1x0]]> 3-6 <![CDATA[0001x2x1x0]]> 7-14 <![CDATA[00001x3x2x1x0]]> 15-30 <![CDATA[000001x4x3x2x1x0]]> 31-62 <![CDATA[0000001x5x4x3x2x1x0]]> 63-126 <![CDATA[00000001x6x5x4x3x2x1x0]]> 127-254 <![CDATA[000000001x7x6x5x4x3x2x1x0]]> 255-510 <![CDATA[0000000001x8x7x6x5x4x3x2x1x0]]> 511-1022 ..... .....
[0027] As shown in the table, the characteristic of unsigned exponential Golomb coding is that the number of bits used increases with the code value. When the code values vary significantly, the difference in the number of bits consumed also increases significantly. Using unsigned exponential Golomb coding to encode the width and height syntax elements consumes a large number of bits at high image resolutions. This encoding method for width and height syntax elements is not very efficient and leaves room for improvement.
[0028] One embodiment of the present invention relates to a method for encoding syntax elements, the specific process is as follows: Figure 1 The syntax element coding method involved in this embodiment can be applied to products such as conference television, set-top boxes, and media codec chips.
[0029] In this embodiment, a first coding value is obtained based on the smaller value of the value of the width syntax element and the value of the height syntax element; a second coding value is obtained based on the absolute value of the difference between the value of the width syntax element and the value of the height syntax element; a third coding value is obtained based on the size relationship between the value of the width syntax element and the value of the height syntax element; the first coding value, the second coding value and the third coding value are encoded in sequence; wherein, the first coding value and the second coding value are subjected to unsigned exponential Golomb coding, and the third coding value is subjected to unsigned exponential Golomb coding or u(1) coding, so as to improve the coding and decoding efficiency of the syntax elements.
[0030] The following is a detailed description of the implementation details of the encoding method of the syntax elements in this embodiment. The following content is only for the convenience of understanding the implementation details and is not necessary for the implementation of this solution. Figure 1 As shown, at least including but not limited to the following steps:
[0031] Step 101: Obtain a first coded value according to the smaller value of the width syntax element and the height syntax element.
[0032] In this step, the value of the width syntax element is the width of the image in the video, and the value of the height syntax element is the height of the image in the video. The values of the width syntax element and the height syntax element are compared, and the smaller of the two is taken as the first coded value. If the first coded value is denoted as A, the first coded value can be expressed as A = MIN(width, height).
[0033] Step 102: Obtain a second coded value according to the absolute value of the difference between the value of the width syntax element and the value of the height syntax element.
[0034] In this step, the difference between the width syntax element and the height syntax element is first calculated. The second coded value is then set to the absolute value of this difference. If the second coded value is denoted as B, the second coded value can be expressed as B = ABS(width, height).
[0035] Step 103: Obtain a third coded value according to the magnitude relationship between the value of the width syntax element and the value of the height syntax element.
[0036] In this step, a third code value is set to represent the magnitude relationship between the value of the width syntax element and the value of the height syntax element. The third code value in this step is preferably a value with a small number of coding bits in the Unsigned Exponential Golomb coding rule.
[0037] In one example, the third coding value is obtained according to the size relationship between the value of the width syntax element and the value of the height syntax element, including: calculating the ratio of the width syntax element and the height syntax element by taking the value of the width syntax element as the numerator and the value of the height syntax element as the denominator; in the case that the ratio is not less than 1, setting the third coding value as a value representing that the value of the width syntax element is not less than the value of the height syntax element; in the case that the ratio is less than 1, setting the third coding value as a value representing that the value of the width syntax element is less than the value of the height syntax element.
[0038] 0 and 1 are the values with the least number of coding bits coded by the unsigned exponential Golomb coding rule, and the third coding value only represents the size relationship between the value of the width syntax element and the value of the height syntax element, and has no actual mathematical meaning. Therefore, in this example, the third coding value can be set to 1 or 0 according to the ratio of the values of the width and height syntax elements. In actual implementation, the third coding value can be set to 1 to represent that the value of the width syntax element is not less than the value of the height syntax element, and the third coding value can be set to 0 to represent that the value of the width syntax element is less than the value of the height syntax element. Alternatively, the third coding value can be set to 0 to represent that the value of the width syntax element is not less than the value of the height syntax element, and the third coding value can be set to 1 to represent that the value of the width syntax element is less than the value of the height syntax element.
[0039] In one example, the width syntax element and the height syntax element involved in the present embodiment both conform to the H.265 / HEVC or H.266 / VVC coding standard. It should be noted that the coding method of the syntax element in the present embodiment is not only applicable to the syntax element conforming to the H.265 / HEVC or H.266 / VVC coding standard, but also applicable to the syntax element conforming to other coding standards.
[0040] In one example in which the width syntax element and the height syntax element both conform to the H.265 / HEVC coding standard, the width syntax element is pic_width_in_luma_samples, and the height syntax element is pic_height_in_luma_samples. In one example in which the width syntax element and the height syntax element both conform to the H.266 / VVC coding standard, the width syntax element can include sps_pic_width_max_in_luma_samples and / or pps_pic_width_in_luma_samples, and the height syntax element can include sps_pic_height_max_in_luma_samples and / or pps_pic_height_in_luma_samples.
[0041] The H.266 / VVC coding standard contains more syntax elements representing image width and height information than previous coding standards, so the coding method in this embodiment is used to code these syntax elements representing image width and height information, which can better save the code rate and greatly improve the coding efficiency.
[0042] In step 104, the first coding value, the second coding value and the third coding value are sequentially coded; wherein the first coding value and the second coding value are subjected to unsigned exponential Golomb coding, and the third coding value is subjected to unsigned exponential Golomb coding or u(1) coding.
[0043] In this step, the coding values obtained in the foregoing step are coded, the first coding value and the second coding value are subjected to unsigned exponential Golomb coding, and the third coding value can also be subjected to unsigned exponential Golomb coding. Unsigned exponential Golomb coding has the characteristic that the smaller the coding value, the fewer the coding bits, so on the basis of replacing the values of the width and height syntax elements with the coding values greatly reduced in the foregoing step as the basis of the coding object, combined with the technical means of coding the coding values by using unsigned exponential Golomb coding, the number of bits consumed for coding the width and height information can be saved.
[0044] The u(1) coding involved in this step is a one-bit unsigned integer coding method, which belongs to entropy coding like unsigned exponential Golomb coding. For the case where the coding value is 0 or 1, u(1) coding is one of the coding methods that can save the most coding bits. Therefore, in this step, the third coding value can also be subjected to u(1) coding.
[0045] In an exemplary embodiment, the width syntax element and the height syntax element both comply with the H.265 / HEVC coding standard. Among them, the width syntax element is pic_width_in_luma_samples, and the height syntax element is pic_height_in_luma_samples. The process of coding the above syntax elements is as follows: first, the coding device compares the values of the pic_width_in_luma_samples and pic_height_in_luma_samples syntax elements. The smaller value can be represented by the syntax element pic_width_heigh_min, that is, the first coding value. The acquisition of the first coding value can be represented by the formula pic_width_heigh_min = MIN(pic_width_in_luma_samples, pic_height_in_luma_samples).
[0046] Subsequently, the absolute value of the difference between the syntax element values of pic_width_in_luma_samples and pic_height_in_luma_samples, that is, the second coded value, can be represented by the syntax element pic_diff_width_height_abs. The second coded value can be obtained by the formula pic_diff_width_height_abs=ABS(pic_width_in_luma_samples-pic_height_in_luma_samples).
[0047] When obtaining the third coded value, a size relationship syntax element, pic_aspect_ratio_flag, indicating the image width-height relationship, can be added and its value used as the third coded value. When width >= height, pic_aspect_ratio_flag is set to 0; when width < height, pic_aspect_ratio_flag is set to 1, completing the acquisition of the third coded value. Finally, the syntax elements, pic_width_heigh_min, pic_diff_width_height_abs, and pic_aspect_ratio_flag, are sequentially unsigned exponential Golomb coding performed and written into the bitstream.
[0048] The embodiment of the present invention associates the image width value with the height value, obtains the difference between the image height value and the width value, and sets a third coding value for characterizing the size relationship between the image height value and the width value. Then, the smaller value of the height value and the width value, the difference between the height value and the width value, and the third coding value are encoded, and the larger value of the two is no longer encoded. The difference between the width and the height and the third coding value are both much smaller than the larger value of the two. Compared with the traditional method of encoding the width and height values of the image, the numerical value of the encoded data is significantly reduced. Combined with the characteristic of the unsigned exponential Golomb coding method that the smaller the coding value, the fewer the coding bits, the number of coding bits can be shortened, thereby improving the coding efficiency of the syntax elements. The u(1) coding method has the characteristic of encoding a small number of coding bits for encoding a one-bit unsigned integer. Therefore, the third coding value characterizing the size relationship between the width and the height of the image is encoded using the u(1) coding method, which can further shorten the number of coding bits and improve the coding efficiency of the syntax elements.
[0049] Another embodiment of the present invention relates to a method for decoding syntax elements, the specific process is as follows: Figure 2As shown. In this embodiment, the received code stream is decoded to obtain a first code value, a second code value and a third code value in sequence; wherein the first code value and the second code value are obtained by unsigned exponential Golomb decoding, and the third code value is obtained by unsigned exponential Golomb decoding or u(1) decoding. The first code value represents the smaller value between the value of the width syntax element and the value of the height syntax element, the second code value represents the absolute value of the difference between the value of the width syntax element and the value of the height syntax element, and the third code value represents the size relationship between the value of the width syntax element and the value of the height syntax element; according to the first code value, the second code value and the third code value, the value of the width syntax element and the value of the height syntax element are obtained.
[0050] The following is a detailed description of the implementation details of the syntax element decoding method in this embodiment. The following content is only for the convenience of understanding the implementation details, and is not necessary for the implementation of this solution. Figure 2 As shown, at least including but not limited to the following steps:
[0051] Step 201: Decode the received code stream to obtain a first code value, a second code value, and a third code value in sequence. The first code value and the second code value are obtained by unsigned exponential Golomb decoding, and the third code value is obtained by unsigned exponential Golomb decoding or u(1) decoding.
[0052] In this step, the first coded value represents the smaller value between the value of the width syntax element and the value of the height syntax element, the second coded value represents the absolute value of the difference between the value of the width syntax element and the value of the height syntax element, and the third coded value represents the size relationship between the value of the width syntax element and the value of the height syntax element.
[0053] Step 202: Obtain a value of a width syntax element and a value of a height syntax element according to the first code value, the second code value, and the third code value.
[0054] In this step, the syntax element decoding apparatus determines the magnitude relationship between the width syntax element and the height syntax element based on the value of the third coded value parsed from the bitstream. Based on this magnitude relationship, it is determined that the smaller of the width and height syntax elements is the first coded value, and the larger of the width and height syntax elements is the sum of the first and second coded values.
[0055] In one example, obtaining the value of the width syntax element and the value of the height syntax element based on the first coding value, the second coding value and the third coding value may include: when the third coding value is a value representing that the value of the width syntax element is not less than the value of the height syntax element, using the first coding value as the value of the height syntax element, and using the sum of the first coding value and the second coding value as the value of the width syntax element; when the third coding value is a value representing that the value of the width syntax element is less than the value of the height syntax element, using the first coding value as the value of the width syntax element, and using the sum of the first coding value and the second coding value as the value of the height syntax element.
[0056] In an example where the third coding value is set to 0 or 1 based on the magnitude relationship between the values of the width and height syntax elements, when the third coding value is 0, the value of the height syntax element is set to the first coding value, and the value of the width syntax element is set to the sum of the first coding value and the second coding value; when the third coding value is 1, the value of the width syntax element is set to the first coding value, and the value of the height syntax element is set to the sum of the first coding value and the second coding value. The flowchart involved in this example is as follows: Figure 3 shown.
[0057] This embodiment can parse the first, second, and third code values from the code stream obtained by encoding according to the above encoding method. The width and height syntax elements are then derived based on the first, second, and third code values, thereby obtaining the height and width of the image in the video. Compared to traditional methods that parse image width and height information from longer codes, this embodiment parses the code values from shorter codes to obtain the width and height, thereby improving decoding efficiency.
[0058] The steps of the above method are divided only for the purpose of clear description. During implementation, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process without changing the core design of the algorithm and process are all within the scope of protection of this patent.
[0059] One embodiment of the present invention relates to a coding device for syntax elements, such as Figure 4 Shown, including:
[0060] A first acquisition module 301 is configured to acquire a first coded value according to a smaller value between a value of a width syntax element and a value of a height syntax element;
[0061] A second acquisition module 302 is configured to acquire a second coded value according to an absolute value of a difference between a value of a width syntax element and a value of a height syntax element;
[0062] A third acquisition module 303 is configured to acquire a third coded value according to a magnitude relationship between a value of the width syntax element and a value of the height syntax element;
[0063] The encoding module 304 is used to encode the first encoding value, the second encoding value and the third encoding value in sequence; wherein, the first encoding value and the second encoding value are encoded by unsigned exponential Golomb coding, and the third encoding value is encoded by unsigned exponential Golomb coding or u(1) coding.
[0064] In one example, the encoding device of the syntax element may also include: a calculation module (not shown in the figure) for calculating the ratio of the width syntax element and the height syntax element; when the ratio is not less than 1, the third encoding value is set to a value representing that the value of the width syntax element is not less than the value of the height syntax element; when the ratio is less than 1, the third encoding value is set to a value representing that the value of the width syntax element is less than the value of the height syntax element.
[0065] The encoding device of the syntax element provided in this embodiment can associate the image width value with the height value, obtain the difference between the image height value and the width value, and set a third encoding value to represent the size relationship between the image height value and the width value. Then, the smaller value of the height value and the width value, the difference between the height value and the width value, and the third encoding value are encoded, and the larger value of the two is no longer encoded. The difference between the width and the height and the third encoding value are both much smaller than the larger value of the two. Compared with the traditional method of encoding the width and height values of the image, the numerical value of the encoded data is significantly reduced. Combined with the characteristic of the unsigned exponential Golomb coding method that the smaller the encoding value, the fewer the encoding bits, the number of encoding bits can be shortened, thereby improving the encoding efficiency of the syntax element. The u(1) encoding has the characteristic of a small number of bits for encoding a one-bit unsigned integer. Therefore, the third encoding value representing the size relationship between the width and the height of the image is encoded using the u(1) encoding method, which can further shorten the number of encoding bits and improve the encoding efficiency of the syntax element.
[0066] One embodiment of the present invention relates to a decoding device for syntax elements, such as Figure 5 Shown, including:
[0067] The parsing module 401 is used to decode the received code stream to obtain a first code value, a second code value, and a third code value in sequence; wherein the first code value and the second code value are obtained by unsigned exponential Golomb decoding, and the third code value is obtained by unsigned exponential Golomb decoding or u(1) decoding. The first code value represents the smaller value between the value of the width syntax element and the value of the height syntax element, the second code value represents the absolute value of the difference between the value of the width syntax element and the value of the height syntax element, and the third code value represents the size relationship between the value of the width syntax element and the value of the height syntax element.
[0068] The acquisition module 402 is configured to acquire a value of a width syntax element and a value of a height syntax element according to the first coding value, the second coding value, and the third coding value.
[0069] In one example, the decoding device of the syntax element may also include: an assignment module (not shown in the figure), which is used to use the first coding value as the value of the height syntax element when the third coding value is a value representing the width syntax element that is not less than the value of the height syntax element, and use the sum of the first coding value and the second coding value as the value of the width syntax element; when the third coding value is a value representing the width syntax element that is less than the value of the height syntax element, use the first coding value as the value of the width syntax element, and use the sum of the first coding value and the second coding value as the value of the height syntax element.
[0070] The syntax element decoding device provided in this embodiment can parse a code stream obtained by encoding according to the above-mentioned encoding method to obtain a first code value, a second code value, and a third code value. Based on the first, second, and third code values, the width and height syntax element values are obtained, that is, the height and width values of the image in the video are obtained. Compared to the traditional method of parsing image width and height information from longer codes, this embodiment parses the code values from shorter codes to obtain width and height, which can improve decoding efficiency.
[0071] It is worth noting that all modules involved in this embodiment are logical modules. In actual applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, to highlight the innovations of the present invention, this embodiment does not include units that are not closely related to solving the technical problems proposed by the present invention. However, this does not mean that other units do not exist in this embodiment.
[0072] An embodiment of the present invention further provides an electronic device, such as Figure 6 As shown, it includes at least one processor 501; and a memory 502 communicatively connected to the at least one processor 501; wherein the memory 502 stores instructions that can be executed by the at least one processor 501, and the instructions are executed by the at least one processor 501 to enable the at least one processor 501 to execute the above-mentioned method for encoding syntax elements, or execute the above-mentioned method for decoding syntax elements.
[0073] The memory 502 and processor 501 are connected using a bus. The bus can include any number of interconnected buses and bridges, connecting various circuits of one or more processors 501 and memory 502. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits. These are all well known in the art and are therefore not described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single component or multiple components, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor 501 is transmitted over a wireless medium via an antenna. Furthermore, the antenna receives data and transmits it to the processor 501.
[0074] The processor 501 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. The memory 502 can be used to store data used by the processor 501 when performing operations.
[0075] The above-mentioned product can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided by the embodiment of the present invention.
[0076] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-mentioned syntax element encoding method or the above-mentioned syntax element decoding method.
[0077] Those skilled in the art will appreciate that all or part of the steps in the above-described embodiments can be accomplished by instructing related hardware through a program stored in a storage medium, which includes a number of instructions for causing a device (which may be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0078] The above-mentioned embodiments are provided to ordinary technicians in this field to implement and use the present invention. Ordinary technicians in this field can make various modifications or changes to the above-mentioned embodiments without departing from the inventive concept of the present invention. Therefore, the scope of protection of the present invention is not limited to the above-mentioned embodiments, but should comply with the maximum scope of the innovative features mentioned in the claims.
Claims
1. A method for encoding a syntax element, characterized in that: include: Obtaining a first coded value according to the smaller value of the width syntax element and the height syntax element; Obtaining a second coded value according to an absolute value of a difference between a value of the width syntax element and a value of the height syntax element; Obtaining a third coded value according to a magnitude relationship between a value of the width syntax element and a value of the height syntax element; The first coding value, the second coding value and the third coding value are encoded in sequence; wherein, the first coding value and the second coding value are unsigned exponential Golomb coding, and the third coding value is unsigned exponential Golomb coding or u(1) coding.
2. The method for encoding syntax elements according to claim 1, wherein: The obtaining, according to a magnitude relationship between a value of the width syntax element and a value of the height syntax element, a third coded value includes: Calculate a ratio of the width syntax element to the height syntax element using the value of the width syntax element as a numerator and the value of the height syntax element as a denominator; If the ratio is not less than 1, setting the third coded value to a value representing that the value of the width syntax element is not less than the value of the height syntax element; When the ratio is less than 1, the third coding value is set to a value representing that the value of the width syntax element is less than the value of the height syntax element.
3. The method for encoding syntax elements according to claim 1, wherein: The width syntax element and the height syntax element both comply with the H.265 / HEVC or H.266 / VVC coding standard.
4. The method for encoding syntax elements according to claim 3, wherein: When both the width syntax element and the height syntax element comply with the H.265 / HEVC coding standard, the width syntax element is pic_width_in_luma_samples; the height syntax element is pic_height_in_luma_samples; In the case where both the width syntax element and the height syntax element comply with the H.266 / VVC coding standard, the width syntax element includes: sps_pic_width_max_in_luma_samples and / or pps_pic_width_in_luma_samples, and the height syntax element includes: sps_pic_height_max_in_luma_samples and / or pps_pic_height_in_luma_samples.
5. A method for decoding a syntax element, characterized in that: include: Decode the received code stream to obtain a first code value, a second code value, and a third code value in sequence; wherein the first code value and the second code value are obtained by unsigned exponential Golomb decoding, the third code value is obtained by unsigned exponential Golomb decoding or u(1) decoding, the first code value represents the smaller value of the value of the width syntax element and the value of the height syntax element, the second code value represents the absolute value of the difference between the value of the width syntax element and the value of the height syntax element, and the third code value represents the size relationship between the value of the width syntax element and the value of the height syntax element; A value of the width syntax element and a value of the height syntax element are obtained according to the first coded value, the second coded value, and the third coded value.
6. The method for decoding syntax elements according to claim 5, wherein: Obtaining, according to the first coded value, the second coded value, and the third coded value, a value of the width syntax element and a value of the height syntax element, including: If the third coded value is a value representing that the value of the width syntax element is not less than the value of the height syntax element, use the first coded value as the value of the height syntax element, and use the sum of the first coded value and the second coded value as the value of the width syntax element; In a case where the third coded value is a value representing that the value of the width syntax element is less than the value of the height syntax element, the first coded value is used as the value of the width syntax element, and the sum of the first coded value and the second coded value is used as the value of the height syntax element.
7. A device for encoding a syntax element, characterized in that: include: A first acquisition module, configured to acquire a first coded value according to a smaller value between a value of a width syntax element and a value of a height syntax element; A second acquisition module, configured to acquire a second coded value according to an absolute value of a difference between a value of the width syntax element and a value of the height syntax element; A third acquisition module, configured to acquire a third coded value according to a magnitude relationship between a value of the width syntax element and a value of the height syntax element; An encoding module is used to encode a first encoding value, a second encoding value and a third encoding value in sequence; wherein, the first encoding value and the second encoding value are encoded using unsigned exponential Golomb coding, and the third encoding value is encoded using unsigned exponential Golomb coding or u(1) coding.
8. A decoding device for syntax elements, characterized in that: include: A parsing module, configured to decode a received code stream to sequentially obtain a first code value, a second code value, and a third code value; wherein the first code value and the second code value are obtained by unsigned exponential Golomb decoding, the third code value is obtained by unsigned exponential Golomb decoding or u(1) decoding, the first code value represents the smaller value of a width syntax element and a height syntax element, the second code value represents the absolute value of a difference between the width syntax element and the height syntax element, and the third code value represents the magnitude relationship between the width syntax element and the height syntax element; An acquisition module is configured to acquire a value of a width syntax element and a value of a height syntax element according to the first coded value, the second coded value, and the third coded value.
9. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the syntax element encoding method according to any one of claims 1 to 4, or to perform the syntax element decoding method according to any one of claims 5 to 6.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for encoding a syntax element according to any one of claims 1 to 4 is implemented, or the method for decoding a syntax element according to any one of claims 5 to 6 is implemented.
Citation Information
Patent Citations
Block Partition Structure in Video Compression
US20190098305A1
Image data encoding / decoding method and apparatus
US20190238888A1