A video decoding method, device, hardware decoder and storage medium

By constructing global and local preset syntax element templates, erroneous encoded blocks in the H.264/HEVC bitstream are detected and recovered, solving the interruption problem of the hardware decoder in case of errors and realizing the continuity and efficient recovery of hardware decoding.

CN115460423BActive Publication Date: 2026-03-27VERISILICON MICROELECTRONICS (SHANGHAI) CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-30
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing hardware decoders cannot recover in time when they detect bitstream errors, resulting in hardware pipeline interruption and inability to effectively handle errors in H.264/HEVC bitstreams.

Method used

By constructing global preset syntax element templates and local preset syntax element templates, erroneous encoded blocks in the target slice are detected and restored to avoid hardware pipeline interruption. The global preset syntax element template is used to merge and assign values ​​to the encoded blocks that need to be restored, and the local preset syntax element template is used to correct erroneous syntax elements, thereby achieving the continuity of hardware decoding.

Benefits of technology

It enables efficient detection and recovery of bitstream errors in the hardware decoder, avoiding hardware pipeline interruptions and improving hardware decoding efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115460423B_ABST
    Figure CN115460423B_ABST
Patent Text Reader

Abstract

The application provides a video decoding method, device, hardware decoder and storage medium. The method comprises: decoding a target slice of a to-be-decoded video; when detecting that a syntax element of the target slice is erroneous, determining a coding block in a frame in which the target slice is located that needs to be recovered; and based on a globally preset syntax element template, recovering the coding block that needs to be recovered to perform forced decoding of the target slice. In this way, timely recovery of an erroneous coding block can be achieved without breaking hardware pipelining (i.e., without hardware interruption when an error is detected). That is, the method can achieve hardware-based code stream error detection and recovery by adding only a small amount of hardware logic, has low complexity, and does not reduce hardware decoding efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of video coding, and in particular, to a video decoding method, device, hardware decoder and storage medium. BACKGROUND

[0002] H.264 (a video coding standard) / HEVC (High Efficiency Video Coding, i.e. H.265) are digital video coding standards proposed by International Standardization Organization and International Telecommunication Union respectively. H.264 / HEVC can provide high compression ratio while ensuring high image quality compared with other formats, and thus is widely used in the industry.

[0003] High data compression ratio means that the bit stream output by the encoder contains little redundant information, and once bit error or loss occurs in the coding or transmission process, it is difficult to recover the complete reconstructed image from the error bit stream. In particular, if the error frame is a reference frame, the subsequent images using the error frame as a reference will be affected, causing error propagation. Therefore, how to detect the error of H.264 / HEVC code stream and recover from the error in time is an important standard for measuring the decoding quality.

[0004] At present, the code stream error detection and recovery cannot be realized by the hardware decoder. Specifically, when the hardware decoder detects that the code stream is wrong, the hardware pipeline will be interrupted, and the error code stream cannot be recovered. SUMMARY

[0005] The embodiments of the present application aim to provide a video decoding method, device, hardware decoder and storage medium to realize code stream error detection and recovery based on hardware.

[0006] The present application is implemented as follows:

[0007] The embodiments of the present application provide a video decoding method, which comprises: decoding a target slice of a to-be-decoded video; when detecting that a syntax element of the target slice is wrong, determining an encoding block that needs to be recovered in a frame where the target slice is located; and recovering the encoding block that needs to be recovered based on a globally preset syntax element template to perform forced decoding of the target slice.

[0008] In the embodiments of the present application, a target slice of a video to be decoded is decoded, when it is detected that a syntax element of the target slice is erroneous, a coding block in a frame in which the target slice is located that needs to be recovered is determined; then the coding block that needs to be recovered is forced to be decoded based on a preset bitstream template, in this way, timely recovery of the coding block that is erroneous can be realized without breaking hardware pipelining (i.e. without hardware interruption when the error is detected). That is, the hardware-based bitstream error detection and recovery can be realized by adding only a small amount of hardware logic, the complexity is low, and the hardware decoding efficiency is not reduced.

[0009] In some possible implementation manners, the global preset syntax element template is constructed by the following steps: a preset value is determined according to a meaning represented by a key syntax element, the key syntax element is used to determine a fixed decoding branch, and the key syntax element is assigned a value according to the determined preset value to obtain the global preset syntax element template.

[0010] In the embodiments of the present application, the global preset syntax element template is obtained by assigning a value to the key syntax element, which can ensure that a fixed decoding branch is selected from a plurality of decoding branches, and ensure that each coding block is decoded according to the fixed decoding branch, so that decoding interruption is avoided and the hardware decoding efficiency is improved.

[0011] In some possible implementation manners, the key syntax element includes a syntax element of a slice header and a syntax element of a coding block.

[0012] In some possible implementation manners, the coding block that needs to be recovered is recovered based on the global preset syntax element template, including: the coding block that needs to be recovered is merged into a new slice; the new slice is recovered based on the global preset syntax element template; and in the recovery process, a slice type of the new slice is determined according to whether the frame in which the target slice is located contains a reference frame.

[0013] In the embodiments of the present application, the coding block that needs to be recovered is recovered by being merged into a new slice, and the slice header and the slice data corresponding to the new slice are assigned values by the global preset syntax element template, so that the hardware pipelining is not broken and the hardware decoding efficiency is improved. In addition, the slice type of the new slice is determined according to whether the frame in which the target slice is located contains a reference frame, that is, when the frame in which the target slice is located contains a reference frame, the new slice can also be recovered based on the reference frame, in this way, the coding block recovery effect can be improved.

[0014] With the technical solution provided in the first aspect above, in some possible implementation manners, the error of the syntax element of the target slice includes an error of a syntax element of a slice header in the target slice.

[0015] In the embodiment of the present application, when the error of the syntax element of the slice header of the target slice is detected, the encoding block that needs to be recovered in the frame where the target slice is located is directly determined, and then the encoding block that needs to be recovered is recovered. In this way, the efficiency of hardware decoding is improved.

[0016] With the technical solution provided in the first aspect above, in some possible implementation manners, the syntax element of the slice header in the target slice is detected by the following steps, including: when it is detected that the number of prefix 0 in a first syntax element is greater than a preset threshold corresponding to the first syntax element, it is determined that the syntax element has an error; wherein the first syntax element is a syntax element based on exponential Golomb coding in the slice header in the target slice.

[0017] In the embodiment of the present application, whether the syntax element in the slice header has an error can be detected only by judging the number of prefix 0 in the first syntax element. This method is efficient and occupies less resources, and is conducive to hardware implementation.

[0018] With the technical solution provided in the first aspect above, in some possible implementation manners, when the error of the syntax element of the target slice is detected, the encoding block that needs to be recovered in the frame where the target slice is located is determined, including: when it is detected that the syntax element of the encoding block in the target slice has an error, a local preset syntax element template is read in to correct the syntax element, and a preset bitstream template is read in at the same time to perform forced decoding on the encoding block; the encoding block that needs to be recovered in the frame where the target slice is located is determined.

[0019] In the embodiment of the present application, when the error of the syntax element of the encoding block in the target slice is detected, the local preset syntax element template and the preset bitstream template can be used to perform forced decoding on the encoding block. In this way, when the encoding block has an error, the hardware pipeline is not damaged, and the subsequent recovery process can continue to be completed.

[0020] With the technical solution provided in the first aspect above, in some possible implementation manners, after the preset bitstream template is read in, the method further includes: in response to the fact that the encoding block to be decoded still has a syntax element with an error, a preset value of the syntax element corresponding to the syntax element with an error in the local preset syntax element template is read in.

[0021] In the embodiments of the present application, after reading in the preset code stream template, if there is still a syntax element with error in the coding block, the preset value of the syntax element corresponding to the syntax element with error in the local preset syntax element template is read in, so as to further implement forced decoding of the coding block.

[0022] In combination with the technical scheme provided in the first aspect, in some possible implementation manners, the syntax elements of the coding block in the target slice are detected by the following steps: when it is detected that the number of syntax elements with prefix 1 in the second syntax element is greater than a preset threshold corresponding to the second syntax element, it is determined that the syntax element has error; wherein the second syntax element is a syntax element in the coding block in the target slice which is coded based on CABAC (Context-based Adaptive Binary Arithmetic Coding, Context-based Adaptive Binary Arithmetic Coding).

[0023] In the embodiments of the present application, the number of prefix 1 of the second syntax element is only needed to be judged to detect whether the syntax element in the coding block has error, which is high in efficiency, low in resource occupation, and beneficial to hardware implementation.

[0024] In combination with the technical scheme provided in the first aspect, in some possible implementation manners, the preset threshold is determined by the coding standard corresponding to each syntax element.

[0025] In combination with the technical scheme provided in the first aspect, in some possible implementation manners, the coding block in the frame in which recovery is needed is determined by: if it is detected that there is no start code in the code stream after the target slice, the coding block in the frame in which recovery is needed is determined; wherein the coding block in which recovery is needed is equal to the total coding block in the frame in which the target slice is located minus the coding block that has been decoded.

[0026] In the embodiments of the present application, if there is no start code in the code stream after the target slice, it is considered that a frame is ended, at this time, the coding block in which recovery is needed can be determined to be equal to the total coding block in the frame in which the target slice is located minus the coding block that has been decoded, it can be seen that by this way, the coding block in which recovery is needed can be effectively determined.

[0027] With the technical solution provided in the first aspect above, in some possible implementation manners, the determining of the encoding blocks in the frame where the target slice is located that need to be recovered comprises: if a start code is detected in the code stream after the target slice, decoding a network abstraction layer packet unit header corresponding to the start code to obtain a type syntax element in the network abstraction layer packet unit header; and determining the encoding blocks in the frame where the target slice is located that need to be recovered based on the type syntax element.

[0028] With the technical solution provided in the first aspect above, in some possible implementation manners, the determining of the encoding blocks in the frame where the target slice is located that need to be recovered based on the type syntax element comprises: if a value of the type syntax element meets a preset condition, determining the encoding blocks in the frame where the target slice is located that need to be recovered; wherein the encoding blocks that need to be recovered are equal to total encoding blocks in the frame where the target slice is located minus encoding blocks that have been decoded currently; and if the value of the type syntax element meets the preset condition, it indicates that the target slice and a next slice do not belong to the same frame; the next slice is a slice in a network abstraction layer packet unit corresponding to the start code.

[0029] In the embodiments of the present application, if a start code exists in the code stream after the target slice, a network abstraction layer packet unit type syntax element is obtained through decoding, and when a value of the type syntax element meets a preset condition, it indicates that the target slice and a next slice do not belong to the same frame, and thus the encoding blocks that need to be recovered can be determined to be equal to total encoding blocks in the frame where the target slice is located minus encoding blocks that have been decoded currently. It can be seen that, through this method, the encoding blocks that need to be recovered can be effectively determined.

[0030] With the technical solution provided in the first aspect above, in some possible implementation manners, the determining of the encoding blocks in the frame where the target slice is located that need to be recovered based on the type syntax element comprises: if the value of the type syntax element does not meet the preset condition, parsing a slice header of the next slice again, and determining the encoding blocks in the frame where the target slice is located that need to be recovered based on a parsing result of the slice header of the next slice; wherein when the parsing result indicates that the target slice and the next slice do not belong to the same frame, the encoding blocks that need to be recovered are equal to total encoding blocks in the frame where the target slice is located minus encoding blocks that have been decoded currently; and when the parsing result indicates that the target slice and the next slice belong to the same frame, the encoding blocks that need to be recovered are equal to a sequence number of a first encoding block of the next slice minus a number of encoding blocks that have been decoded currently.

[0031] In the embodiment of the present application, when the value of the type syntax element does not satisfy the preset condition, the slice header of the next slice is parsed again, so that whether the target slice and the next slice belong to the same frame can be effectively and accurately determined, and the reliability of the determined encoding block to be recovered is improved.

[0032] In a second aspect, the embodiment of the present application provides a video decoding device, which comprises: a decoding module configured to decode a target slice of a video to be decoded; a detecting module configured to determine an encoding block to be recovered in a frame where the target slice is located when detecting that a syntax element of the target slice is in error; and a recovering module configured to recover the encoding block to be recovered based on a global preset syntax element template, so as to perform forced decoding on the target slice.

[0033] In a third aspect, the embodiment of the present application provides a hardware decoder configured to perform the method provided in the first aspect and / or any possible implementation manner of the first aspect.

[0034] In a fourth aspect, the embodiment of the present application further provides a nonvolatile computer readable storage medium (hereinafter referred to as computer readable storage medium) having a computer program stored thereon, and the computer program is configured to perform the method provided in the first aspect and / or any possible implementation manner of the first aspect when the computer program is run by a computer. BRIEF DESCRIPTION OF DRAWINGS

[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments of the present application. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0036] Figure 1 The step flow chart of the video decoding method provided by an embodiment of the present application.

[0037] Figure 2 The composition structure diagram of a code stream provided by an embodiment of the present application.

[0038] Figure 3 The step flow chart of the video decoding method provided by another embodiment of the present application.

[0039] Figure 4 The flow chart of determining the encoding block to be recovered provided by an embodiment of the present application.

[0040] Figure 5 The flow chart of determining the encoding block to be recovered provided by another embodiment of the present application.

[0041] Figure 6 This is a schematic diagram illustrating an error in the fragmentation of an I-frame according to an embodiment of this application.

[0042] Figure 7 for Figure 6 The recovery image after an error occurs in the fragmentation of an I-frame.

[0043] Figure 8 This is a schematic diagram illustrating an error in the fragmentation of a P-frame according to an embodiment of this application.

[0044] Figure 9 for Figure 8 The recovery image after an error occurred in the P-frame fragmentation. Detailed Implementation

[0045] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0046] Please see Figure 1 , Figure 1 This is a flowchart illustrating the steps of a video decoding method provided in an embodiment of this application. The video decoding method provided in this embodiment does not... Figure 1 The following order is a limitation, and the method includes: steps S101-S103.

[0047] Step S101: Decode the target segment of the video to be decoded.

[0048] The target segment is any segment of the bitstream of the video to be decoded. The following describes the composition structure of the bitstream, as follows: Figure 2 As shown, the bitstream consists of multiple bitstream units. Each bitstream unit consists of a start code and a NAL Unit (Network Abstraction Layer Packet Unit). That is, each start code is followed by an NAL Unit. The NAL Unit consists of a NALU header and NALU data.

[0049] NALU data can include a slice header and slice data. The slice header and slice data are combined to form a slice. This step involves decoding the slice composed of the slice header and slice data.

[0050] The slice header is used to describe the characteristics / properties of the whole slice and the like. The slice data includes the coding blocks. For example, when the coding adopts the H.264 coding standard, the coding block is a macroblock (MB), and when the coding adopts the HEVC coding standard, the coding block is a coding tree block (CTB). In subsequent examples of the present application, both the H.264 coding standard and the HEVC coding standard are exemplified. It can be understood that the video decoding method provided by the embodiments of the present application is not limited to the two coding standards in the examples.

[0051] It should be noted that the error detection can be completed in the decoding process.

[0052] In an embodiment, when the decoder (which can be a hardware decoder or a software decoder) decodes the syntax elements, if the syntax elements exceed the range specified in the standard, or are obviously contradictory to other syntax elements, or cannot be decoded from the code stream to obtain valid syntax elements, it is indicated that an error occurs in the syntax elements.

[0053] In an embodiment, the number of characters in the prefix of the syntax element can be used to detect the error when the decoder decodes the syntax element.

[0054] The syntax elements in the slice header of the target slice are detected, and the detection process can specifically include: judging whether the number of prefix 0 of the first syntax element is greater than a preset threshold corresponding to the first syntax element; when there is a syntax element in the first syntax element, the number of prefix 0 of which is greater than the preset threshold corresponding to the first syntax element, an error occurs in the syntax element. Otherwise, no error occurs in the syntax element.

[0055] The first syntax element is a syntax element based on exponential Golomb coding in the slice header of the target slice. That is, the detection method only needs to count the number of prefix 0 of the syntax element based on exponential Golomb coding. This method is efficient and occupies less resources, and is conducive to hardware implementation.

[0056] Taking the H.264 coding standard as an example, the first syntax elements and the respective preset thresholds can refer to Table 1.

[0057] Table 1

[0058]

[0059]

[0060] The first column in Table 1 represents the first syntax elements, and the second column in Table 1 represents preset thresholds corresponding to the respective first syntax elements. For example, the preset threshold corresponding to the first syntax element slice_type is 3. Illustratively, the hardware decoder judges whether the number of prefix 0 of slice_type is greater than 3 before decoding the first syntax element slice_type. If yes, slice_type is erroneous.

[0061] It should be noted that the first syntax elements shown in Table 1 are only examples and are not intended to be limiting.

[0062] For example, the first syntax elements and the respective preset thresholds can refer to Table 2 when the encoding adopts the HEVC encoding standard.

[0063] Table 2

[0064] HEVC syntax element slice_header() Number of prefix 0s slice_pic_parameter_set_id >6 slice_type >1 num_ref_idx_l0_active_minus1 >3 num_ref_idx_l1_active_minus1 >3 collocated_ref_idx >3 five_minus_max_num_merge_cand >2 delta_luma_weight_l0 >8 luma_offset_l0 >8 delta_chroma_weight_l0 >8 delta_chroma_offset_l0 >10 delta_luma_weight_l1 >8 luma_offset_l1 >8 delta_chroma_weight_l1 >8 delta_chroma_offset_l1 >10 luma_log2_weight_denom >3 delta_chroma_log2_weight_denom >3 slice_qp_delta >6 slice_cb_qp_offset >6 slice_cr_qp_offset >6 slice_beta_offset_div2 >3 slice_tc_offset_div2 >3 num_entry_point_offsets >8 offset_len_minus1 >5 slice_segment_header_extension_length >8

[0065] The first column in Table 2 represents the first syntax elements, and the second column in Table 2 represents preset thresholds corresponding to the respective first syntax elements. For example, the preset threshold corresponding to the first syntax element slice_type is 1. Illustratively, the hardware decoder judges whether the number of prefix 0 of slice_type is greater than 1 before decoding the first syntax element slice_type. If yes, slice_type is erroneous.

[0066] It should be noted that the first syntax elements shown in Table 2 are only examples and are not intended to be limiting.

[0067] In addition, it should be noted that the respective preset thresholds of the first syntax elements are determined by the encoding standard. That is, the preset thresholds corresponding to the different first syntax elements in different encoding standards are determined by the respective encoding standards.

[0068] It should be noted that when the error of the certain syntax element of the slice header in the target slice is detected, the detection and decoding of the subsequent syntax elements are stopped, and step S102 is performed. In this way, the efficiency of the hardware decoding can be improved.

[0069] The syntax elements of the encoding block in the target slice are detected. The detection process can specifically include: judging whether the number of prefix 1 of the second syntax element is greater than the preset threshold corresponding to the second syntax element; when the number of prefix 1 of the second syntax element is greater than the preset threshold corresponding to the second syntax element, the syntax element is erroneous. Otherwise, the syntax element is not erroneous.

[0070] The second syntax element is a syntax element based on CABAC coding in the coding block in the target slice. That is, the detection method only needs to count the number of prefix 1 of the syntax element based on CABAC coding. The method is efficient and occupies less resources, and is beneficial to hardware implementation.

[0071] Taking H.264 coding standard as an example, the second syntax element and the respective preset threshold can refer to Table 3.

[0072] Table 3

[0073]

[0074] The first column in Table 3 represents the second syntax element, and the second column in Table 3 represents the preset threshold corresponding to each second syntax element. For example, the preset threshold corresponding to the second syntax element mb_qp_delta is 64. For example, when the hardware decoder decodes the second syntax element mb_qp_delta, it is determined whether the number of prefix 1 of the decoded mb_qp_delta is greater than 64 in the decoding process. If yes, the mb_qp_delta is incorrect.

[0075] The second syntax element shown in Table 3 is only an example and is not limited.

[0076] It should be noted that the syntax element based on CABAC coding is encoded by a special CABAC coding engine, and vice versa. The syntax element based on CABAC coding is decoded by a special CABAC decoding engine. In the decoding process, the number of prefixes is determined, that is, all the numbers before 0 are the prefixes of the syntax element. When 0 is decoded, the number of 1 before 0 is the number of prefix 1 of the syntax element. The K-order exponential Golomb coding described above is one of the coding methods in the CABAC coding engine.

[0077] Taking HEVC coding standard as an example, the second syntax element and the respective preset threshold can refer to Table 4.

[0078] Table 4

[0079]

[0080] The first list in Table Four represents the second syntax elements, and the second list in Table Four represents preset threshold values corresponding to the respective second syntax elements. For example, the preset threshold value corresponding to the second syntax element coeff_abs_level_rem is 23. Illustratively, when the hardware decoder decodes the second syntax element coeff_abs_level_rem, in the decoding process, it is determined whether the number of prefixes 1 of the decoded coeff_abs_level_rem is greater than 23. If yes, the coeff_abs_level_rem is erroneous.

[0081] It should be noted that the second syntax elements shown in Table Four are merely examples and are not intended to be limiting.

[0082] In addition, it should be noted that the preset threshold values corresponding to the respective second syntax elements are determined by the encoding standard. That is, the preset threshold values corresponding to the different second syntax elements in different encoding standards are determined by the respective encoding standards.

[0083] It should be noted that, when it is detected that an error occurs in a certain syntax element in a coding block in a target slice, the subsequent syntax elements are stopped from being detected and decoded, at which time, the coding block in which the error occurs needs to be recovered, and after the coding block in which the error occurs is recovered, step S102 is executed.

[0084] In the embodiments of the present application, when it is detected that an error occurs in a syntax element in a coding block in a target slice, the syntax element is corrected using a local preset syntax element template, and a preset bitstream template is read in to perform forced decoding of the coding block.

[0085] That is, when it is detected that an error occurs in a syntax element in a coding block in a target slice, at which time, the decoder can enter a set partial coding block recovery mode, first corrects the syntax element using a local preset syntax element template, and continues decoding from the erroneous syntax element. If an error occurs in a subsequent syntax element, the subsequent syntax element is continuously corrected using the local preset syntax element template, until the decoding of the current erroneous coding block is completed, that is, the decoder will not stop working because of an error in a coding block. In this process, the hardware decoder will not consume a real bitstream, but directly read in a pseudo bitstream, which is the preset bitstream template described above.

[0086] In an embodiment, the preset bitstream template can include an all-1 template or an all-0 template or other preset binary bit string templates, such as a binary bit string template containing both 1 and 0, without limitation in the present application.

[0087] In an embodiment, after reading the preset bitstream template, the method further comprises: in response to the fact that there are still syntax elements with errors in the to-be-decoded coding block, reading preset values of syntax elements corresponding to the syntax elements with errors in the local preset syntax element template.

[0088] That is, when there are still errors in the local syntax elements after reading the preset bitstream template, the preset local preset syntax element template can be used to continue error correction so as to complete decoding of the coding block. The local preset syntax element template can be set according to different syntax elements, which is not limited in the present application.

[0089] It can be seen that in the embodiment of the present application, after reading the preset bitstream template, if there are still syntax elements with errors in the to-be-decoded coding block, the syntax elements with errors are directly set to corresponding values in the local preset syntax element template, so as to implement forced decoding of the coding block.

[0090] The above process will be described below in combination with Figure 3 The above process will be described below in combination with

[0091] In addition, if no syntax element error is detected in the target slice, the next slice is continuously decoded, and the subsequent steps do not need to be executed.

[0092] Step S102: determining coding blocks that need to be recovered in a frame in which the target slice is located.

[0093] When a syntax element error is detected in the target slice, coding blocks that need to be recovered in a frame in which the target slice is located need to be determined.

[0094] Optionally, the coding blocks that need to be recovered in the frame in which the target slice is located are determined by: judging whether there is a start code in a bitstream after the target slice; if there is no start code in the bitstream after the target slice, the coding blocks that need to be recovered in the frame in which the target slice is located are determined.

[0095] In which, the coding blocks that need to be recovered are equal to total coding blocks in the frame in which the target slice is located minus coding blocks that have been decoded.

[0096] It should be noted that if the start code does not exist in the code stream after the target slice, it is considered that a frame is ended, at this time, the encoding blocks to be recovered can be determined as equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding, it can be seen that through this way, the encoding blocks to be recovered can be effectively determined.

[0097] Here, the encoding blocks to be recovered can be determined according to the number, for example, the total encoding blocks in the frame where the target slice is located are 100, and the encoding blocks that have been completed decoding are 80, then the number of the encoding blocks to be recovered is 20, at this time, the 20 encoding blocks after the error position of the target slice are the encoding blocks to be recovered.

[0098] Optionally, if the start code exists in the code stream after the target slice, the network abstraction layer packet unit header corresponding to the start code is decoded to obtain a type syntax element in the network abstraction layer packet unit header; based on the type syntax element, the encoding blocks to be recovered in the frame where the target slice is located are determined.

[0099] Specifically, the determination of the encoding blocks to be recovered in the frame where the target slice is located based on the type syntax element includes: if the value of the type syntax element meets a preset condition, the encoding blocks to be recovered in the frame where the target slice is located are determined; wherein the encoding blocks to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding; if the value of the type syntax element meets the preset condition, it is indicated that the target slice and the next slice do not belong to the same frame; the next slice is the slice in the network abstraction layer packet unit corresponding to the start code.

[0100] That is, if the start code is found in the code stream after the target slice, the network abstraction layer packet unit header (NALU header) is decoded to obtain the type syntax element Nal Unit type.

[0101] Taking the H.264 encoding standard as an example, the preset condition can include:

[0102] Condition one: the current frame is an Instantaneous Decoder Refresh (IDR) frame, and the value of Nal Unit type is not equal to 5.

[0103] Condition two: the current frame is a non-IDR frame, and Nal Unit type is equal to 5.

[0104] It should be noted that the first image frame of a frame sequence is an IDR frame, and the IDR frame is an I frame in the frame sequence. The non-IDR frame includes other I frames in the frame sequence, P frames and B frames in the frame sequence.

[0105] The I frame mentioned above represents a key frame, and the frame picture is completely retained; only the frame data is needed to complete decoding. The P frame is a forward prediction encoding frame, and the P frame represents the difference between this frame and a previous key frame (or P frame). When decoding, the previous buffered picture is superimposed on the difference defined by the current frame to generate the final picture. The B frame is a bidirectional prediction interpolation encoding frame. The B frame is a bidirectional prediction frame, and the B frame records the difference between the current frame and the previous and subsequent frames.

[0106] When the Nal Unit type meets one of the above two conditions, it indicates that the target slice and the next slice do not belong to the same frame (the Nal Unit type indicates the type of a network abstraction layer packet unit), at this time, it is determined that the encoding blocks that need to be recovered in the frame where the target slice is located are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding.

[0107] Taking that the encoding adopts the HEVC encoding standard as an example, the preset conditions can include:

[0108] Condition one: the Nal Unit type is greater than 21.

[0109] Condition two: the current frame is an IDR / BLA (Broken Link Access) / CRA (Clean Random Access) frame, and the Nal Unit type is less than 16.

[0110] Condition three: the current frame is a non-IDR / BLA / CRA frame, and the Nal Unit type is greater than or equal to 16.

[0111] It should be noted that the IDR frame, the BLA frame, and the CRA frame are all random access point images and belong to the I frame.

[0112] When the Nal Unit type meets one of the above three conditions, it indicates that the target slice and the next slice do not belong to the same frame, and the next slice is the beginning of a new frame, at this time, it is determined that the encoding blocks that need to be recovered in the frame where the target slice is located are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding.

[0113] In the embodiments of the present application, if there is a start code in the code stream after the target slice, the corresponding network abstraction layer packet unit type syntax element is obtained through decoding, and when the value of the type syntax element meets the preset condition, it indicates that the target slice and the next slice do not belong to the same frame, at this time, it can be determined that the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding. It can be seen that through this way, the encoding blocks that need to be recovered can be effectively determined.

[0114] Optionally, if the value of the type syntax element does not satisfy the preset condition, the slice header of the next slice is parsed again, and based on the parsing result of the slice header of the next slice, the encoding blocks that need to be recovered in the frame where the target slice is located are determined.

[0115] When the parsing result indicates that the target slice and the next slice do not belong to the same frame, i.e., the parsing result indicates that the next slice is the beginning of a new frame, the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been decoded currently. When the parsing result indicates that the target slice and the next slice belong to the same frame, the encoding blocks that need to be recovered are equal to the sequence number of the first encoding block of the next slice minus the number of encoding blocks that have been decoded currently. The sequence number of the first encoding block of the next slice can be obtained from the syntax element in the slice header of the next slice.

[0116] i.e., the Slice header (i.e., the slice header) of the next slice is decoded continuously.

[0117] Taking the H.264 encoding standard as an example, the specific process of determining the encoding blocks that need to be recovered in the frame where the target slice is located can include:

[0118] Step S201: decode the syntax element first_mb_in_slice. If the value is less than the number of macroblocks that have been decoded, indicating that the target slice and the next slice do not belong to the same frame (first_mb_in_slice indicates the sequence number of the first encoding block corresponding to the slice), the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been decoded currently. Otherwise, go to step S202.

[0119] Step S202: decode the syntax element slice_type. If the current frame is an IDR frame but slice type is not Islice, indicating that the target slice and the next slice do not belong to the same frame (slice_type indicates the slice type of the slice), the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been decoded currently. Otherwise, go to step S203.

[0120] Step S203: decode the syntax element pic_parameter_set_id, if the value is not equal to the pic_parameter_set_id corresponding to the slice header before the error, indicating that the target slice and the next slice do not belong to the same frame (pic_parameter_set_id indicates the picture parameter set sequence number corresponding to the slice, and the value must be the same for all slices of the same frame), then the coding blocks that need to be recovered are equal to the total coding blocks in the frame where the target slice is located minus the coding blocks that have been completed decoding, otherwise, go to step S204. If the error slice is the first slice in a frame, go directly to step S204.

[0121] Step S204: decode the syntax element frame_num, if the value is not equal to the frame_num corresponding to the slice header before the error, indicating that the target slice and the next slice do not belong to the same frame (frame_num indicates the frame number corresponding to the slice, and the value must be the same for all slices of the same frame), then the coding blocks that need to be recovered are equal to the total coding blocks in the frame where the target slice is located minus the coding blocks that have been completed decoding, otherwise, go to step S205. If the error slice is the first slice in a frame, go directly to step S205.

[0122] Step S205: decode the syntax element idr_pic_id, if the value is not equal to the idr_pic_id corresponding to the slice header before the error, indicating that the target slice and the next slice do not belong to the same frame (idr_pic_id indicates the IDR image identification number corresponding to the slice, and the value must be the same for all slices of the same frame), then the coding blocks that need to be recovered are equal to the total coding blocks in the frame where the target slice is located minus the coding blocks that have been completed decoding, otherwise, go to step S206. If the error slice is the first slice in a frame, go directly to step S206.

[0123] Step S206: determine that the target slice and the next slice belong to the same frame, then the coding blocks that need to be recovered are equal to the total coding blocks in the frame where the target slice is located minus the coding blocks that have been completed decoding before the next slice, that is, the coding blocks that need to be recovered are equal to first_mb_in_slice minus the coding blocks that have been completed decoding.

[0124] Taking the case that the coding adopts the HEVC coding standard, the specific process of determining the coding blocks that need to be recovered in the frame where the target slice is located can include:

[0125] Step S301: decode the syntax element first_slice_segment_in_pic_flag, if the value is 1 and the number of macroblocks already decoded is greater than 0, indicating that the target slice and the next slice do not belong to the same frame (first_slice_segment_in_pic_flag indicates whether the slice is the first slice in a frame), then the number of coding blocks to be recovered is equal to the total number of coding blocks in the frame where the target slice is located minus the coding blocks that have been decoded so far, otherwise go to step S302.

[0126] Step S302: decode the syntax element slice_pic_parameter_set_id, if the value is not equal to the slice_pic_parameter_set_id corresponding to the slice header before the error, indicating that the target slice and the next slice do not belong to the same frame (slice_pic_parameter_set_id indicates the picture parameter set sequence number corresponding to the slice, and for all slices in the same frame, the value must be the same), then the number of coding blocks to be recovered is equal to the total number of coding blocks in the frame where the target slice is located minus the coding blocks that have been decoded so far, otherwise go to step S303. If the error slice is the first slice in a frame, go directly to step S303.

[0127] Step S303: decode the syntax element slice_segment_address, if the value corresponds to a macroblock position that has been successfully decoded, indicating that the target slice and the next slice do not belong to the same frame (slice_segment_address indicates the sequence number of the first coding block corresponding to the slice), then the number of coding blocks to be recovered is equal to the total number of coding blocks in the frame where the target slice is located minus the coding blocks that have been decoded so far, otherwise go to step S304.

[0128] Step S304: decode the syntax element slice_type, if the current frame is an IDR / BLA / CRA frame but the slice_type is not I slice, indicating that the target slice and the next slice do not belong to the same frame (slice_type indicates the slice type), then the number of coding blocks to be recovered is equal to the total number of coding blocks in the frame where the target slice is located minus the coding blocks that have been decoded so far, otherwise go to step S305.

[0129] Step S305: determine that the target slice and the next slice belong to the same frame, then the number of coding blocks to be recovered is equal to the total number of coding blocks in the frame where the target slice is located before the next slice minus the coding blocks that have been decoded so far, i.e., the number of coding blocks to be recovered is equal to slice_segment_address minus the coding blocks that have been decoded so far.

[0130] In summary, in the embodiment of the present application, when the value of the network abstraction layer packet unit type syntax element does not satisfy the preset condition, the header of the next slice is decoded, and then it can be effectively and accurately determined whether the target slice and the next slice belong to the same frame, and thus the reliability of the determined encoding blocks that need to be recovered is improved.

[0131] Please refer to Figure 4 Taking an example of that the encoding adopts the H.264 encoding standard and the decoder is a hardware decoder, the completion process of the determined encoding blocks that need to be recovered can include: the hardware decoder searches for the next start code, if the next start code is found, the NALU header is parsed, it is judged whether the Nal Unit type indicates the start of a new frame, if yes, the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding. If no, the Slice header is parsed, it is judged whether the first_mb_in_slice indicates the start of a new frame, if yes, the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding. If no, it is judged whether the slice_type indicates the start of a new frame, if yes, the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding. If no, it is judged whether the pic_parameter_set_id indicates the start of a new frame, if yes, the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding. If no, it is judged whether the frame_num indicates the start of a new frame, if yes, the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding. If no, it is judged whether the idr_pic_id indicates the start of a new frame, if yes, the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding. If no, the encoding blocks that need to be recovered are equal to the first_mb_in_slice minus the encoding blocks that have been completed decoding.

[0132] Please refer to Figure 5For example, when the encoding adopts the HEVC encoding standard and the decoder is a hardware decoder, the completion process of the encoding block to be recovered can include: the hardware decoder searches for the next start code, if the next start code is found, the NALU header is parsed, it is determined whether the Nal Unit type indicates the start of a new frame, if yes, the encoding block to be recovered is equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding. If no, the Slice header is parsed, it is determined whether the first_slice_segment_in_pic_flag indicates the start of a new frame, if yes, the encoding block to be recovered is equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding. If no, it is determined whether the slice_pic_parameter_set_id indicates the start of a new frame, if yes, the encoding block to be recovered is equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding. If no, it is determined whether the slice_segment_address indicates the start of a new frame, if yes, the encoding block to be recovered is equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding. If no, it is determined whether the slice_type indicates the start of a new frame, if yes, the encoding block to be recovered is equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been completed decoding. If no, the encoding block to be recovered is equal to the slice_segment_address minus the encoding blocks that have been completed decoding.

[0133] Step S103: Recovering the encoding block to be recovered based on the global preset syntax element template to perform decoding on the target slice.

[0134] After determining the encoding block to be recovered, the encoding block to be recovered is recovered based on the global preset syntax element template to perform decoding on the target slice.

[0135] Firstly, the process of constructing the global preset syntax element template is described, which can specifically include: determining the preset value according to the meaning represented by the key syntax element; the key syntax element is used to determine a fixed decoding branch; and the key syntax element is assigned according to the determined preset value to obtain the global preset syntax element template.

[0136] It should be noted that the key syntax element can ensure that a fixed decoding branch is selected from a plurality of decoding branches, so that each encoding block is decoded according to the fixed decoding branch, thereby avoiding decoding interruption and improving hardware decoding efficiency. Therefore, only the key syntax element needs to be assigned.

[0137] The preset syntax element template of the slice header is shown in the following table:

[0138]

[0139]

[0140] It should be noted that all syntax elements prefixed with pps represent the picture parameter set syntax elements to which the current frame belongs.

[0141] The picture parameter set is used to describe the common information of multiple coded pictures and is also transmitted by the network abstraction layer packet unit, and the value of the corresponding type syntax element (NAL unit type) is 8.

[0142] It should be noted that the preset value of the slice header syntax element not listed in the table is 0.

[0143] The recovery process in step S103 can further include: combining the coded blocks to be recovered into a new slice for recovery, so as to complete the decoding of the target slice.

[0144] The slice header and slice data syntax elements corresponding to the new slice are assigned values by the global preset syntax element template. That is, in an embodiment, the key syntax elements can include the syntax elements of the slice header and the syntax elements of the coded blocks.

[0145] The slice type of the new slice is determined by whether the frame in which the target slice is located contains a reference frame. That is, if the reference frame list corresponding to the frame in which the target slice is located contains a valid reference frame, the slice type is set to P slice, otherwise it is set to I slice.

[0146] The preset syntax element template of the H264 slice data is shown in the following table:

[0147]

[0148] The preset syntax element template of the HEVC slice data is shown in the following table:

[0149]

[0150] It should be noted that the difference between the global preset syntax element template and the local preset syntax element template in the partial coded block recovery process is as follows:

[0151] 1. A global preset syntax element template contains slice header and slice data syntax elements, and presets key syntax elements in the slice header and slice data syntax elements, for example, including but not limited to presetting the key syntax element values described in the above table. Wherein, according to the key syntax elements, a fixed decoding branch can be selected from a plurality of decoding branches, and each encoding block is decoded according to the fixed decoding branch, so as to avoid decoding interruption and improve hardware decoding efficiency.

[0152] 2. A local preset syntax element template only contains slice data syntax elements, and all syntax elements in the slice data are preset, so that after reading the code stream template of all 0 or all 1, or other binary sequence, if any syntax element error occurs in the decoding process, the preset value of the corresponding syntax element in the local preset syntax element template can be used for correction, thereby realizing forced decoding of the partially error encoding block.

[0153] It can be seen that in the embodiment of the present application, the encoding blocks to be recovered are combined into a new slice for recovery, and the slice header and slice data corresponding to the new slice are assigned values by the global preset syntax element template, so that the hardware pipeline can not be damaged and the hardware decoding efficiency can be improved. Moreover, the slice type of the new slice is determined according to whether the frame containing the target slice contains a reference frame, that is, when the frame containing the target slice contains a reference frame, the new slice can also be recovered based on the reference frame. In this way, the recovery effect of the encoding block can be improved.

[0154] In summary, in the embodiment of the present application, the target slice of the to-be-decoded video is decoded, and when it is detected that the syntax elements of the target slice are error, the encoding blocks to be recovered in the frame containing the target slice are determined. Then, the global preset syntax element template is used to force decode the encoding blocks to be recovered. In this way, the timely recovery of the error encoding block can be realized without damaging the hardware pipeline (i.e., without hardware interruption when the error is detected). That is, the code stream error detection and recovery based on hardware can be realized by adding only a small amount of hardware logic, which has low complexity and does not reduce the hardware decoding efficiency.

[0155] When the video decoding method provided by the above embodiment is applied to specific decoding, the decoding effect comparison chart can refer to Figure 6-9 .

[0156] Among them, Figure 6 is a schematic diagram when the slice of the I frame is error. Figure 7 is a corresponding Figure 6 recovery diagram after the slice of the I frame is error. Figure 8 is a schematic diagram when the slice of the P frame is error. Figure 9 is a correspondingFigure 8 The recovery image after an error occurred in the P-frame fragmentation.

[0157] It should be noted that, Figure 6 and Figure 8 The square boxes in the image represent coding blocks. Each segment consists of three rows of coding blocks. Figure 6 The bottom middle section contains the erroneous coded block, because... Figure 6 As a keyframe, it cannot be fully recovered if its coded block is corrupted. Figure 8 The middle part is the erroneous encoded block, because Figure 8 As a forward-predictive coded frame, it can be recovered based on previous keyframes, therefore, its erroneous coded blocks can be fully recovered.

[0158] Based on the same inventive concept, this application also provides a video decoding device, the device comprising:

[0159] The decoding module is used to decode the target segments of the video to be decoded.

[0160] The detection module is used to determine the coded blocks that need to be recovered in the frame where the target segment is located when an error is detected in the syntax elements of the target segment.

[0161] The recovery module is used to recover the encoded block that needs to be recovered based on a globally preset syntax element template, so as to perform forced decoding of the target segment.

[0162] Optionally, the device further includes a construction module, which is used to determine a preset value based on the meaning represented by the key syntax element; the key syntax element is used to determine a fixed decoding branch; and the key syntax element is assigned a value based on the determined preset value to obtain the global preset syntax element template.

[0163] Optionally, the key syntax elements include syntax elements for the fragment header and syntax elements for the encoded block.

[0164] Optionally, the recovery module is further configured to merge the encoded blocks to be recovered into a new fragment; recover the new fragment based on the global preset syntax element template; wherein, during the recovery process, the fragment type of the new fragment is determined by whether the frame containing the target fragment contains a reference frame.

[0165] Optionally, an error in the syntax elements of the target fragment includes an error in the syntax elements of the fragment header in the target fragment.

[0166] Optionally, the detection module is further configured to determine that the syntax element is erroneous when it is detected that the number of prefix 0s in the first syntax element is greater than a preset threshold corresponding to the first syntax element, wherein the first syntax element is a syntax element based on exponential Golomb coding in a slice header in the target slice.

[0167] Optionally, the detection module is further configured to read in a local preset syntax element to correct the syntax element of the coding block in the target slice when it is detected that the syntax element of the coding block in the target slice is erroneous, and simultaneously read in a preset bitstream template to perform forced decoding on the coding block, and determine the coding blocks that need to be recovered in the frame in which the target slice is located.

[0168] Optionally, the detection module is further configured to read in a local preset syntax element template corresponding to the syntax element that is detected as being erroneous after reading in the preset bitstream template.

[0169] Optionally, the detection module is further configured to determine that the syntax element is erroneous when it is detected that the number of prefix 1s in the second syntax element is greater than a preset threshold corresponding to the second syntax element, wherein the second syntax element is a syntax element based on CABAC coding in the coding block in the target slice.

[0170] Optionally, the preset threshold is determined by a coding standard corresponding to each syntax element.

[0171] Optionally, the detection module is further configured to determine the coding blocks that need to be recovered in the frame in which the target slice is located if it is detected that there is no start code in the bitstream after the target slice, wherein the coding blocks that need to be recovered are equal to the total number of coding blocks in the frame in which the target slice is located minus the coding blocks that have been decoded.

[0172] Optionally, the detection module is further configured to decode a network abstraction layer packet unit header corresponding to the start code to obtain a type syntax element in the network abstraction layer packet unit header if it is detected that there is a start code in the bitstream after the target slice, and determine the coding blocks that need to be recovered in the frame in which the target slice is located based on the type syntax element.

[0173] Optionally, the detecting module is further configured to determine the encoding blocks that need to be recovered in the frame where the target slice is located, if the value of the type syntax element meets the preset condition; wherein the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been decoded; if the value of the type syntax element meets the preset condition, it indicates that the target slice and the next slice do not belong to the same frame; the next slice is the slice in the network abstraction layer packet unit corresponding to the start code.

[0174] Optionally, the detecting module is further configured to parse the slice header of the next slice again, and determine the encoding blocks that need to be recovered in the frame where the target slice is located based on the parsing result of the slice header of the next slice; wherein when the parsing result indicates that the target slice and the next slice do not belong to the same frame, the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been decoded; when the parsing result indicates that the target slice and the next slice belong to the same frame, the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located before the next slice minus the encoding blocks that have been decoded.

[0175] Based on the same inventive concept, the embodiment of the present application further provides a hardware decoder. The hardware decoder is used to execute the video decoding method provided by the above-mentioned embodiments.

[0176] The hardware decoder is a hardware device that decodes digital audio and video signals into analog audio and video signals. The hardware decoder can be composed of an application specific integrated circuit, and the present application is not limited.

[0177] The embodiment of the present application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program. When the computer program is run by a computer, the steps included in the packet processing method are executed.

[0178] It should be noted that each of the embodiments in the present specification describes in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same and similar parts of each embodiment can be referred to each other.

[0179] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can also be implemented by other manners. The apparatus embodiments described above are merely illustrative, for example, the flowcharts and block diagrams in the drawings show the possible implementation architecture, function and operation of the apparatus, method and computer program product according to the embodiments of the present application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logic function. It should also be noted that in some alternative implementation manners, the functions noted in the blocks can also occur in different order from that noted in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can also be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for executing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0180] In addition, the function modules in the embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0181] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a notebook computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0182] In this document, the relationship terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between the entities or operations.

[0183] The above merely provides an example of the present application, and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims

1. A method of video decoding, the method comprising: The method comprises: decoding a target slice of a video to be decoded; when detecting that a syntax element of the target slice is erroneous, determining a coding block that needs to be recovered in a frame in which the target slice is located; recovering the coding block that needs to be recovered based on a globally preset syntax element template to perform forced decoding of the target slice; the step of determining the coding block that needs to be recovered in the frame in which the target slice is located when detecting that the syntax element of the target slice is erroneous comprises: when detecting that a syntax element of a coding block in the target slice is erroneous, reading a locally preset syntax element template to correct the syntax element, and simultaneously reading a preset bitstream template to perform forced decoding of the coding block; and determining the coding block that needs to be recovered in the frame in which the target slice is located; the globally preset syntax element template is constructed by: determining a preset value according to a meaning represented by a key syntax element used to determine a fixed decoding branch; and assigning the key syntax element according to the determined preset value to obtain the globally preset syntax element template; the step of recovering the coding block that needs to be recovered based on the globally preset syntax element template comprises: merging the coding block that needs to be recovered into a new slice; and recovering the new slice based on the globally preset syntax element template; wherein, in the process of recovery, a slice type of the new slice is determined according to whether the frame in which the target slice is located contains a reference frame.

2. The method of claim 1, wherein, The key syntax element comprises a syntax element of a slice header and a syntax element of a coding block.

3. The method of claim 1, wherein, The erroneous syntax element of the target slice comprises an erroneous syntax element of a slice header in the target slice.

4. The method of claim 3, wherein, The syntax element of the slice header in the target slice is detected by: when detecting that a syntax element in which a number of prefix 0s is greater than a preset threshold corresponding to the syntax element exists in a first syntax element, it is determined that the syntax element is erroneous; wherein the first syntax element is a syntax element based on exponential Golomb coding in the slice header in the target slice.

5. The method of claim 1, wherein, After the preset bitstream template is read, the method further comprises: in response to the coding block to be decoded still having an erroneous syntax element, reading a preset value of a syntax element corresponding to the erroneous syntax element in the locally preset syntax element template.

6. The method of claim 1, wherein, The syntax element of the coding block in the target slice is detected by: when detecting that a syntax element in which a number of prefix 1s is greater than a preset threshold corresponding to the syntax element exists in a second syntax element, it is determined that the syntax element is erroneous; wherein the second syntax element is a syntax element based on CABAC coding in the coding block in the target slice.

7. The method according to claim 4 or 6, characterized in that, The preset threshold is determined by a coding standard corresponding to each syntax element.

8. The method of claim 1, wherein, The coding block that needs to be recovered in the frame in which the target slice is located is determined by: If it is detected that there is no start code in the code stream after the target slice, it is determined that the encoding blocks that need to be recovered in the frame where the target slice is located; wherein the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been decoded.

9. The method of claim 1, wherein, The determination of the encoding blocks that need to be recovered in the frame where the target slice is located comprises: If it is detected that there is a start code in the code stream after the target slice, the network abstraction layer packet unit header corresponding to the start code is decoded to obtain a type syntax element in the network abstraction layer packet unit header; Based on the type syntax element, it is determined that the encoding blocks that need to be recovered in the frame where the target slice is located.

10. The method of claim 9, wherein, The determination of the encoding blocks that need to be recovered in the frame where the target slice is located based on the type syntax element comprises: If the value of the type syntax element meets a preset condition, it is determined that the encoding blocks that need to be recovered in the frame where the target slice is located; wherein the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been decoded; if the value of the type syntax element meets the preset condition, it indicates that the target slice and the next slice do not belong to the same frame; the next slice is a slice in the network abstraction layer packet unit corresponding to the start code.

11. The method of claim 9, wherein, The determination of the encoding blocks that need to be recovered in the frame where the target slice is located based on the type syntax element comprises: If the value of the type syntax element does not meet the preset condition, the slice header of the next slice is parsed again, and based on the parsing result of the slice header of the next slice, it is determined that the encoding blocks that need to be recovered in the frame where the target slice is located; wherein when the parsing result indicates that the target slice and the next slice do not belong to the same frame, the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located minus the encoding blocks that have been decoded; when the parsing result indicates that the target slice and the next slice belong to the same frame, the encoding blocks that need to be recovered are equal to the total encoding blocks in the frame where the target slice is located before the next slice minus the encoding blocks that have been decoded.

12. A video decoding apparatus, comprising: The device comprises: a decoding module configured to decode a target slice of a video to be decoded; a detection module configured to, when it is detected that a syntax element in the target slice is incorrect, determine the encoding blocks that need to be recovered in the frame where the target slice is located; a recovery module configured to recover the encoding blocks that need to be recovered based on a globally preset syntax element template to perform forced decoding of the target slice; the detection module is configured to, when it is detected that a syntax element in an encoding block in the target slice is incorrect, read a locally preset syntax element template to correct the syntax element, and simultaneously read a preset code stream template to perform forced decoding of the encoding block; and determine the encoding blocks that need to be recovered in the frame where the target slice is located; The global preset syntax element template is constructed by the following steps: determining a preset value according to the meaning represented by a key syntax element; the key syntax element is used to determine a fixed decoding branch; and assigning a value to the key syntax element according to the determined preset value to obtain the global preset syntax element template; The recovery module is configured to combine the encoding blocks that need to be recovered into a new slice, and recover the new slice based on the global preset syntax element template; wherein, in the recovery process, the slice type of the new slice is determined according to whether the frame containing the target slice contains a reference frame.

13. A hardware decoder, characterized by A computer program product comprising computer readable instructions which, when executed by a computer, cause the computer to carry out the method of any one of claims 1-11.

14. A computer-readable storage medium, characterized in that, A computer program product comprising computer readable instructions which, when executed by a computer, cause the computer to carry out the method of any one of claims 1-11.

Citation Information

Patent Citations

  • Method for realizing H.264CAVLC decoding fault tolerance function and decoder

    CN105681801A

  • Transmission apparatus and reception apparatus for parallel data streams

    US20220182686A1