WO2023236113A1 - 视频编解码方法、装置、设备、系统及存储介质 - Google Patents

视频编解码方法、装置、设备、系统及存储介质 Download PDF

Info

Publication number
WO2023236113A1
WO2023236113A1 PCT/CN2022/097683 CN2022097683W WO2023236113A1 WO 2023236113 A1 WO2023236113 A1 WO 2023236113A1 CN 2022097683 W CN2022097683 W CN 2022097683W WO 2023236113 A1 WO2023236113 A1 WO 2023236113A1
Authority
WO
WIPO (PCT)
Prior art keywords
quantization
current block
coefficient
coefficients
quantization coefficient
Prior art date
Application number
PCT/CN2022/097683
Other languages
English (en)
French (fr)
Inventor
黄航
徐陆航
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Priority to PCT/CN2022/097683 priority Critical patent/WO2023236113A1/zh
Publication of WO2023236113A1 publication Critical patent/WO2023236113A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/46Embedding additional information in the video signal during the compression process
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/46Embedding additional information in the video signal during the compression process
    • H04N19/463Embedding additional information in the video signal during the compression process by compressing encoding parameters before transmission
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/46Embedding additional information in the video signal during the compression process
    • H04N19/467Embedding additional information in the video signal during the compression process characterised by the embedded information being invisible, e.g. watermarking

Definitions

  • the present application relates to the technical field of video coding and decoding, and in particular to a video coding and decoding method, device, equipment, system and storage medium.
  • Digital video technology can be incorporated into a variety of video devices, such as digital televisions, smartphones, computers, e-readers, or video players.
  • video data includes a larger amount of data.
  • video devices implement video compression technology to make the video data more efficiently transmitted or stored.
  • the transform coefficients are quantized.
  • the purpose of quantization is to scale the transform coefficients, thereby reducing the number of bits consumed when encoding the coefficients.
  • the current quantization method has a high encoding cost.
  • Embodiments of the present application provide a video encoding and decoding method, device, equipment, system and storage medium to reduce the cost of quantization encoding.
  • this application provides a video decoding method, including:
  • the i-th first quantization coefficient among the N first quantization coefficients is the first response to the i-th second quantization coefficient in the current block.
  • the quantized coefficient obtained after the characteristics are hidden, the N is a positive integer, and the i is a positive integer less than or equal to N;
  • the i-th second quantization coefficient is determined according to the first characteristics of the i-th first quantization coefficient and the i-th second quantization coefficient.
  • embodiments of the present application provide a video encoding method, including:
  • the i-th first quantization coefficient is encoded to obtain a code stream.
  • the first characteristic of the i-th second quantization coefficient is determined by the area corresponding to the i-th second quantization coefficient in the current block. The second characteristic is identified.
  • An eighth aspect provides a chip for implementing any one of the above-mentioned first to second aspects or the method in each implementation manner thereof.
  • the chip includes: a processor, configured to call and run a computer program from a memory, so that the device installed with the chip executes any one of the above-mentioned first to second aspects or implementations thereof. method.
  • a twelfth aspect provides a code stream, including a code stream generated by any aspect of the second aspect.
  • the first characteristics of the N second quantization coefficients in the current block are hidden to obtain N first quantization coefficients, and the N first quantization coefficients are encoded during encoding, which can reduce the encoding requirements.
  • the number of bits reduces the cost of video compression.
  • Figure 2 is a schematic block diagram of a video encoder provided by an embodiment of the present application.
  • Figure 3 is a schematic block diagram of a decoding framework provided by an embodiment of the present application.
  • Figure 5 is a schematic flow chart of a video decoding method provided by an embodiment of the present application.
  • Figure 6 is a schematic diagram of the distribution of N first quantization coefficients in an embodiment of the present application.
  • Figure 7 is a schematic diagram of the distribution of N first quantization coefficients and corresponding areas in an embodiment of the present application.
  • Figure 9 is a schematic flow chart of a video decoding method provided by an embodiment of the present application.
  • Figure 10 is a schematic flow chart of a video encoding method provided by an embodiment of the present application.
  • Figure 11 is a schematic flow chart of a video encoding method provided by an embodiment of the present application.
  • Figure 12 is a schematic block diagram of a video decoding device provided by an embodiment of the present application.
  • Figure 13 is a schematic block diagram of a video encoding device provided by an embodiment of the present application.
  • Figure 14 is a schematic block diagram of an electronic device provided by an embodiment of the present application.
  • Figure 15 is a schematic block diagram of a video encoding and decoding system provided by an embodiment of the present application.
  • This application can be applied to the fields of image encoding and decoding, video encoding and decoding, hardware video encoding and decoding, dedicated circuit video encoding and decoding, real-time video encoding and decoding, etc.
  • the solution of this application can be operated in conjunction with other proprietary or industry standards, including ITU-TH.261, ISO/IECMPEG-1Visual, ITU-TH.262 or ISO/IECMPEG-2Visual, ITU-TH.263 , ISO/IECMPEG-4Visual, ITU-TH.264 (also known as ISO/IECMPEG-4AVC), including scalable video codec (SVC) and multi-view video codec (MVC) extensions.
  • SVC scalable video codec
  • MVC multi-view video codec
  • FIG. 1 For ease of understanding, the video encoding and decoding system involved in the embodiment of the present application is first introduced with reference to FIG. 1 .
  • the encoding device 110 may transmit the encoded video data (eg, code stream) to the decoding device 120 via the channel 130 .
  • Channel 130 may include one or more media and/or devices capable of transmitting encoded video data from encoding device 110 to decoding device 120 .
  • channel 130 includes one or more communication media that enables encoding device 110 to transmit encoded video data directly to decoding device 120 in real time.
  • encoding device 110 may modulate the encoded video data according to the communication standard and transmit the modulated video data to decoding device 120.
  • the communication media includes wireless communication media, such as radio frequency spectrum.
  • the communication media may also include wired communication media, such as one or more physical transmission lines.
  • channel 130 includes a storage medium that can store video data encoded by encoding device 110 .
  • Storage media include a variety of local access data storage media, such as optical disks, DVDs, flash memories, etc.
  • the decoding device 120 may obtain the encoded video data from the storage medium.
  • channel 130 may include a storage server that may store video data encoded by encoding device 110 .
  • the decoding device 120 may download the stored encoded video data from the storage server.
  • the storage server may store the encoded video data and may transmit the encoded video data to the decoding device 120, such as a web server (eg, for a website), a File Transfer Protocol (FTP) server, etc.
  • FTP File Transfer Protocol
  • the encoding device 110 may include a video source 111 in addition to the video encoder 112 and the input interface 113 .
  • the video encoder 112 transmits the encoded video data directly to the decoding device 120 via the output interface 113 .
  • the encoded video data can also be stored on a storage medium or storage server for subsequent reading by the decoding device 120 .
  • the video decoder 122 is used to decode the encoded video data to obtain decoded video data, and transmit the decoded video data to the display device 123.
  • the display device 123 displays the decoded video data.
  • Display device 123 may be integrated with decoding device 120 or external to decoding device 120 .
  • Display device 123 may include a variety of display devices, such as a liquid crystal display (LCD), a plasma display, an organic light emitting diode (OLED) display, or other types of display devices.
  • LCD liquid crystal display
  • plasma display a plasma display
  • OLED organic light emitting diode
  • FIG. 2 is a schematic block diagram of a video encoder provided by an embodiment of the present application. It should be understood that the video encoder 200 can be used to perform lossy compression of images (lossy compression), or can also be used to perform lossless compression (lossless compression) of images.
  • the lossless compression can be visually lossless compression (visually lossless compression) or mathematically lossless compression (mathematically lossless compression).
  • a CTU can be further divided into several coding units (Coding Units, CUs) for encoding.
  • CUs can be rectangular blocks or square blocks.
  • CU can be further divided into prediction unit (PU for short) and transform unit (TU for short), thus enabling coding, prediction, and transformation to be separated and processing more flexible.
  • the CTU is divided into CUs in a quad-tree manner, and the CU is divided into TUs and PUs in a quad-tree manner.
  • Video encoders and video decoders can support various PU sizes. Assuming that the size of a specific CU is 2N ⁇ 2N, the video encoder and video decoder can support a PU size of 2N ⁇ 2N or N ⁇ N for intra prediction, and support 2N ⁇ 2N, 2N ⁇ N, N ⁇ 2N, N ⁇ N or similar sized symmetric PU for inter prediction. The video encoder and video decoder can also support 2N ⁇ nU, 2N ⁇ nD, nL ⁇ 2N and nR ⁇ 2N asymmetric PUs for inter prediction.
  • the video encoder 200 may include: a prediction unit 210, a residual unit 220, a transform/quantization unit 230, an inverse transform/quantization unit 240, a reconstruction unit 250, and a loop filter unit. 260. Decode the image cache 270 and the entropy encoding unit 280. It should be noted that the video encoder 200 may include more, less, or different functional components.
  • the reference frame found based on the motion vector is A block of whole pixels or sub-pixels is called a reference block.
  • Some technologies will directly use the reference block as a prediction block, and some technologies will process the reference block to generate a prediction block. Reprocessing to generate a prediction block based on a reference block can also be understood as using the reference block as a prediction block and then processing to generate a new prediction block based on the prediction block.
  • the intra prediction method also includes a multiple reference line intra prediction method (multiple reference line, MRL).
  • MRL can use more reference pixels to improve coding efficiency.
  • mode 0 is to copy the pixels above the current block in the vertical direction to the current block as the prediction value
  • mode 1 is to copy the reference pixel on the left to the current block in the horizontal direction as the prediction value
  • mode 2 is to copy A ⁇
  • the average value of the eight points D and I ⁇ L is used as the predicted value of all points.
  • Mode 3 to mode 8 copy the reference pixel to the corresponding position of the current block at a certain angle. Because some positions of the current block cannot exactly correspond to the reference pixels, it may be necessary to use the weighted average of the reference pixels, or the sub-pixels of the interpolated reference pixels.
  • the intra-frame prediction modes used by HEVC include planar mode (Planar), DC and 33 angle modes, for a total of 35 prediction modes.
  • the intra-frame modes used by VVC include Planar, DC and 65 angle modes, for a total of 67 prediction modes.
  • the intra-frame modes used by AVS3 include DC, Plane, Bilinear and 63 angle modes, for a total of 66 prediction modes.
  • Residual unit 220 may generate a residual block of the CU based on the pixel block of the CU and the prediction block of the PU of the CU. For example, residual unit 220 may generate a residual block of a CU such that each sample in the residual block has a value equal to the difference between the sample in the pixel block of the CU and the PU of the CU. Predict the corresponding sample in the block.
  • Transform/quantization unit 230 may quantize the transform coefficients. Transform/quantization unit 230 may quantize transform coefficients associated with the TU of the CU based on quantization parameter (QP) values associated with the CU. Video encoder 200 may adjust the degree of quantization applied to transform coefficients associated with the CU by adjusting the QP value associated with the CU.
  • QP quantization parameter
  • Inverse transform/quantization unit 240 may apply inverse quantization and inverse transform to the quantized transform coefficients, respectively, to reconstruct the residual block from the quantized transform coefficients.
  • Reconstruction unit 250 may add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by prediction unit 210 to produce a reconstructed image block associated with the TU. By reconstructing blocks of samples for each TU of a CU in this manner, video encoder 200 can reconstruct blocks of pixels of the CU.
  • Loop filtering unit 260 may perform deblocking filtering operations to reduce blocking artifacts for blocks of pixels associated with the CU.
  • the loop filtering unit 260 includes a deblocking filtering unit, a sample adaptive compensation SAO unit, and an adaptive loop filtering ALF unit.
  • Decoded image cache 270 may store reconstructed pixel blocks.
  • Inter prediction unit 211 may perform inter prediction on PUs of other images using reference images containing reconstructed pixel blocks.
  • intra prediction unit 212 may use the reconstructed pixel blocks in decoded image cache 270 to perform intra prediction on other PUs in the same image as the CU.
  • Entropy encoding unit 280 may receive the quantized transform coefficients from transform/quantization unit 230 . Entropy encoding unit 280 may perform one or more entropy encoding operations on the quantized transform coefficients to generate entropy encoded data.
  • the basic process of video encoding involved in this application is as follows: at the encoding end, the current image is divided into blocks, and for the current block, the prediction unit 210 uses intra prediction or inter prediction to generate a prediction block of the current block.
  • the residual unit 220 may calculate a residual block based on the prediction block and the original block of the current block, that is, the difference between the prediction block and the original block of the current block.
  • the residual block may also be called residual information.
  • the residual block undergoes transformation and quantization processes such as transformation/quantization unit 230 to remove information that is insensitive to human eyes to eliminate visual redundancy.
  • the video encoder performs inverse quantization and inverse transformation on the quantized transform coefficients output by the transform and quantization unit 230 to obtain the residual block of the current block, and then adds the residual block of the current block and the prediction block of the current block, Get the reconstructed block of the current block.
  • reconstruction blocks corresponding to other image blocks in the current image can be obtained, and these reconstruction blocks are spliced to obtain a reconstructed image of the current image. Since errors are introduced during the encoding process, in order to reduce the error, the reconstructed image is filtered.
  • ALF is used to filter the reconstructed image to reduce the difference between the pixel value of the pixel in the reconstructed image and the original pixel value of the pixel in the current image. difference.
  • the filtered reconstructed image is stored in the decoded image cache 270 and can be used as a reference frame for inter-frame prediction for subsequent frames.
  • the block division information determined by the encoding end as well as mode information or parameter information such as prediction, transformation, quantization, entropy coding, loop filtering, etc., are carried in the code stream when necessary.
  • the decoding end determines the same block division information as the encoding end by parsing the code stream and analyzing the existing information, prediction, transformation, quantization, entropy coding, loop filtering and other mode information or parameter information, thereby ensuring the decoded image obtained by the encoding end It is the same as the decoded image obtained by the decoding end.
  • Figure 3 is a schematic block diagram of a video decoder provided by an embodiment of the present application.
  • prediction unit 320 includes inter prediction unit 321 and intra prediction unit 322.
  • Inter prediction unit 321 may perform intra prediction to generate predicted blocks for the PU. Inter prediction unit 321 may use an intra prediction mode to generate predicted blocks for a PU based on pixel blocks of spatially neighboring PUs. Inter prediction unit 321 may also determine the intra prediction mode of the PU based on one or more syntax elements parsed from the codestream.
  • Intra prediction unit 322 may construct a first reference image list (List 0) and a second reference image list (List 1) based on syntax elements parsed from the codestream. Additionally, if the PU uses inter-prediction encoding, entropy decoding unit 310 may parse the motion information of the PU. Intra-prediction unit 322 may determine one or more reference blocks for the PU based on the motion information of the PU. Intra-prediction unit 322 may generate a predicted block for the PU based on one or more reference blocks of the PU.
  • Inverse quantization/transform unit 330 may inversely quantize (ie, dequantize) transform coefficients associated with a TU. Inverse quantization/transform unit 330 may use the QP value associated with the CU of the TU to determine the degree of quantization.
  • inverse quantization/transform unit 330 may apply one or more inverse transforms to the inverse quantized transform coefficients to produce a residual block associated with the TU.
  • Reconstruction unit 340 uses the residual blocks associated with the TU of the CU and the prediction blocks of the PU of the CU to reconstruct the pixel blocks of the CU. For example, reconstruction unit 340 may add samples of the residual block to corresponding samples of the prediction block to reconstruct the pixel block of the CU to obtain a reconstructed image block.
  • Loop filtering unit 350 may perform deblocking filtering operations to reduce blocking artifacts for blocks of pixels associated with the CU.
  • Video decoder 300 may store the reconstructed image of the CU in decoded image cache 360 .
  • the video decoder 300 may use the reconstructed image in the decoded image cache 360 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation.
  • the entropy decoding unit 310 can parse the code stream to obtain the prediction information, quantization coefficient matrix, etc. of the current block.
  • the prediction unit 320 uses intra prediction or inter prediction for the current block based on the prediction information to generate the current block.
  • the inverse quantization/transform unit 330 uses the quantization coefficient matrix obtained from the code stream to perform inverse quantization and inverse transformation on the quantization coefficient matrix to obtain a residual block.
  • the reconstruction unit 340 adds the prediction block and the residual block to obtain a reconstruction block.
  • the reconstructed blocks constitute a reconstructed image
  • the loop filtering unit 350 performs loop filtering on the reconstructed image based on the image or based on the blocks to obtain a decoded image.
  • the decoded image can also be called a reconstructed image.
  • the reconstructed image can be displayed by the display device, and on the other hand, it can be stored in the decoded image buffer 360 and used as a reference frame for inter-frame prediction for subsequent frames.
  • t i is the transformation coefficient
  • qstep is the quantization step size, which is related to the quantization parameters set in the configuration file
  • q i is the quantization coefficient
  • round is the rounding process, which is not limited to upper rounding or lower rounding, etc., the quantization process Controlled by the encoder.
  • t′ i is the reconstructed transformation coefficient. Due to the accuracy loss caused by the rounding process, t′ i and t i are different.
  • Quantization will reduce the accuracy of the transform coefficients, and the loss of accuracy is irreversible.
  • Encoders usually measure the cost of quantization through a rate-distortion cost function.
  • J is the quantization cost
  • D is the distortion
  • R is the code rate
  • is the function of the quantization parameter QP
  • B() is the bits consumed by the encoder to estimate the encoding quantization coefficient q i .
  • multi-symbol arithmetic coding may be used to encode or decode the quantized coefficients, and each quantized coefficient may be indicated by one or more multi-symbol identifiers. Specifically, Depending on the size of the quantization coefficient, it can be segmented and represented by the following multi-symbol identification bits.
  • Identifier 2 represents the part from 3 to 6, with a total of 4 symbols (0, 1, 2, 3). When the symbol of identifier 2 is 3, further encoding/decoding of identifier 3 is required.
  • Identifier 3 represents the part from 6 to 9, with a total of 4 symbols (0, 1, 2, 3). When the symbol of identifier 3 is 3, further encoding/decoding of identifier 4 is required.
  • encoding/decoding identifies 1-5 in scanning order from the last non-zero coefficient to the upper left corner of the transform block.
  • S() is the multi-symbol context model coding
  • L(1) is the bypass coding
  • a Diagonal scan (diagonal scan) as shown in Figure 4A is usually used, or a Zig-Zag scan (Zigzag scan) as shown in Figure 4B is used.
  • scanning methods such as Column scan (column scan) and Row scan (row scan) can also be used when encoding and decoding coefficients.
  • the embodiments of the present application do not limit the specific scanning method of the transform block.
  • each transformation block can be divided into multiple areas, and one area is scanned as a scanning unit. After the scanning of one area is completed, other areas are scanned.
  • the actual coefficient decoding order is defined as the reverse scanning order, that is, starting from the first non-zero coefficient in the lower right corner of the transform block, sequential decoding is performed in decoding order. For example, as shown in FIG. 4A and FIG. 4B , decoding is performed from the first non-zero coefficient in the lower right corner of the transform block to the upper left corner of the transform block in decoding order.
  • the current encoding method of quantized coefficients is usually to fully encode the quantized coefficients, for example, fully encoding the absolute value of the quantized coefficients, which occupies a lot of bits and is expensive to encode.
  • the first characteristic of the second quantized coefficient in the current block is hidden, the first quantized coefficient is obtained, and the first quantized coefficient is encoded, so as to reduce the time required for encoding. number of bits, thereby reducing the encoding cost.
  • the i-th first quantization coefficient among the N first quantization coefficients is a quantization coefficient obtained by hiding the first characteristic of the i-th second quantization coefficient in the current block
  • N is a positive integer
  • i is less than Or a positive integer equal to N.
  • the quantization coefficient whose parity is hidden is called the first quantization coefficient.
  • the first quantized coefficient whose parity is hidden is also called a hidden coefficient.
  • the current block may also be called the current transform block or the current decoding block, etc.
  • the coding end in order to reduce the coding cost, hides the first characteristics of the N second quantization coefficients in the current block to obtain N first quantization coefficients. For example, the coding end hides the i-th second quantization coefficient. The first characteristic of the coefficient is hidden, and the i-th first quantized coefficient is obtained. In this way, during encoding, the encoding end encodes the N first quantization coefficients instead of encoding the N second quantization coefficients. Since the N first quantization coefficients are obtained by hiding the first characteristics of the N second quantization coefficients, the coded values of the N first quantized coefficients are smaller than the N second quantized coefficients, so that the coded values are smaller. When encoding the N first quantization coefficients, fewer bits can be used, thereby reducing the encoding cost.
  • the first characteristic is a sign.
  • the first quantized coefficient is a quantized coefficient obtained by hiding the sign of the second quantized coefficient at the corresponding position.
  • the first characteristic is parity.
  • the first quantized coefficient is obtained by hiding part of the absolute value of the second quantized coefficient according to the parity of the second quantized coefficient at the corresponding position. Quantization coefficient.
  • the above-mentioned quantized coefficients are obtained by quantizing the transform coefficients.
  • the encoding end predicts the current block to obtain the predicted value of the current block, and subtracts the original value of the current block from the predicted value to obtain the residual value of the current block.
  • the encoding end transforms the residual value to obtain the transform coefficient of the current block, then quantizes the transform coefficient to obtain the quantized coefficient, and then encodes the quantized coefficient to obtain the code stream.
  • S501-A Decode the code stream and obtain the number of quantization coefficients of the current block.
  • S501-B Determine N first quantization coefficients according to the number of quantization coefficients of the current block.
  • S501-B2. Determine the number of first quantization coefficients in the current block according to the number of quantization coefficients in the current block and the first threshold;
  • S501-B2 is executed to determine the number of first quantization coefficients in the current block based on the number of quantization coefficients of the current block and the first threshold.
  • the embodiments of this application do not limit the specific implementation of the above S501-B2.
  • the rounded value of the ratio of the number of quantization coefficients of the current block to the first threshold is determined as the number of the first quantization coefficients in the current block.
  • the decoded information of the current block includes the quantized coefficients of the current block that are less than 16, and then the current block is determined from the decoded information of the current block based on the number and position of the first quantized coefficients in the current block.
  • the N first quantized coefficients of the block.
  • the above-mentioned at least one flag includes a sequence-level flag, which is used to indicate whether the current sequence allows the first characteristic of the quantized coefficient to be hidden. For example, if the value of the sequence-level flag is 1, it indicates that the current sequence allows the first characteristic of the quantized coefficient to be hidden; if the value of the sequence-level flag is 0, it indicates that the current sequence does not allow the first characteristic of the quantized coefficient. hidden.
  • the above-mentioned at least one flag includes a slice-level flag, which is used to indicate whether the current slice (slice) allows the first characteristic of the quantized coefficient to be hidden. For example, if the value of the slice-level flag is 1, it indicates that the current slice allows the first characteristic of the quantized coefficient to be hidden; if the value of the slice-level flag is 0, it indicates that the current slice does not allow the first characteristic of the quantized coefficient. hidden.
  • the above-mentioned at least one flag includes a unit-level flag, which is used to indicate whether the current CTU allows the first characteristic of the quantized coefficient to be hidden. For example, if the value of the unit-level flag is 1, it indicates that the current CTU allows the first characteristic of the quantized coefficient to be hidden; if the value of the unit-level flag is 0, it indicates that the current CTU does not allow the first characteristic of the quantized coefficient. hidden.
  • the decoder first decodes the code stream to obtain at least one of the above flags, and determines whether the current block allows the first characteristic of the quantized coefficient to be hidden based on the at least one flag. If it is determined based on at least one of the above flags that the current block does not allow the first characteristic of the quantized coefficient to be hidden, the method in the embodiment of the present application is skipped, and the decoded quantized coefficient is directly inversely quantized to obtain the transform coefficient. If it is determined based on at least one of the above flags that the current block is allowed to use the first feature hiding technology provided by the embodiment of the present application, then the method of the embodiment of the present application is executed.
  • the decoder first decodes the code stream to obtain the sequence-level flag. If the sequence-level flag indicates that the current sequence does not allow the use of the first feature hiding technology provided by the embodiment of the present application, the method of the embodiment of the present application is skipped and the method is used. The traditional method is to dequantize the current block. If the sequence-level flag indicates that the current sequence is allowed to use the first feature hiding technology provided by the embodiment of the present application, continue to decode the code stream to obtain the image-level flag.
  • the image-level flag indicates that the current image is not allowed to use the first feature hiding technology provided by the embodiment of the present application.
  • the method in the embodiment of the present application is skipped, and the traditional method is used to dequantize the current block. If the picture-level flag indicates that the current picture is allowed to use the first feature hiding technology provided by the embodiment of the present application, continue to decode the code stream to obtain the slice-level flag. If the slice-level flag indicates that the current picture is not allowed to use the first feature hiding technology provided by the embodiment of the present application.
  • the method in the embodiment of the present application is skipped, and the traditional method is used to dequantize the current block.
  • the slice-level flag indicates that the current slice is allowed to use the first feature hiding technology provided by the embodiment of the present application, continue to decode the code stream to obtain the unit-level flag. If the unit-level flag indicates that the current CTU is not allowed to use the first feature hiding technology provided by the embodiment of the present application. When using the first characteristic hiding technology, the method in the embodiment of the present application is skipped, and the traditional method is used to dequantize the current block. If the unit-level flag indicates that the current CTU is allowed to use the first feature hiding technology provided by the embodiment of the present application, continue to decode the code stream to obtain the block-level flag. If the block-level flag indicates that the current block is not allowed to use the first feature hiding technology provided by the embodiment of the present application.
  • the method in the embodiment of the present application is skipped, and the traditional method is used to dequantize the current block. If the block-level flag indicates that the current block is allowed to use the first feature hiding technology provided by the embodiment of the present application, then the embodiment of the present application is executed.
  • the first feature hiding technology provided by the embodiments of the present application is mutually exclusive with the target transformation method, where the target transformation method includes secondary transformation or multiple transformations.
  • the decoding end determines that the current block is transformed using the target transformation method, it skips the technical solution provided by the embodiment of the present application, for example, skips the above-mentioned step S501.
  • the code stream is decoded, and after the N first quantization coefficients of the current block are determined, the following step S502 is performed.
  • the method for determining the area corresponding to each first quantization coefficient in the current block among the N first quantization coefficients is the same.
  • the i-th first quantization among the N first quantization coefficients is used The coefficients are taken as an example for illustration, in which the i-th first quantized coefficient is any first quantized coefficient among the N first quantized coefficients.
  • the method of determining the area corresponding to the i-th first quantization coefficient in the current block is not limited.
  • the area corresponding to each of the N first quantization coefficients in the current block does not include the first quantization coefficient.
  • the i-th first quantization coefficient is in The corresponding area in the current block does not include any one of the N first quantization coefficients.
  • the area corresponding to at least one of the N first quantization coefficients includes the first quantization coefficient, and the area corresponding to at least one first quantization coefficient does not include the first quantization coefficient.
  • the area corresponding to the i-th first quantization coefficient includes any one or several first quantization coefficients among the N first quantization coefficients, and the area corresponding to the j-th first quantization coefficient does not include any of the N first quantization coefficients.
  • the j-th first quantized coefficient is any first quantized coefficient among the N first quantized coefficients except the i-th first quantized coefficient.
  • the area except the N first quantization coefficients in the current block is divided into N areas, and the divided N areas are allocated to the N first quantization coefficients one by one, thereby obtaining N first The area corresponding to each first quantization coefficient in the current block among the quantization coefficients.
  • the area corresponding to each of the N first quantization coefficients in the current block does not include the first quantization coefficient.
  • the area corresponding to the i-th first quantization coefficient in the current block Does not include any first quantization coefficient among the N first quantization coefficients.
  • the process of dividing the area in the current block except the N first quantization coefficients into N areas is introduced below.
  • the area other than the N first quantization coefficients in the current block is called other areas.
  • both the decoding end and the encoding end use the default region division method to divide other regions of the current block into N regions.
  • At least two areas among the N areas include the same number of quantization coefficients.
  • every K pixels in other areas of the current block are divided into one area, resulting in N areas.
  • N areas are of the same size, and each area includes K pixels. There may be areas in these N areas where the quantization coefficients are all 0.
  • the quantization coefficient included in the last region is not K, the last region is divided into a separate region, or the last region and the previous region are merged into one region.
  • the above-mentioned N areas are sub-blocks of the current block.
  • other areas of the current block are evenly divided into N sub-blocks.
  • the size of each sub-block is 4*4.
  • the flag A may be a sequence-level flag, used to indicate that all decoding blocks in the sequence may use this region division method to divide the decoding blocks into N regions.
  • the flag A may be a slice-level flag, used to indicate that all decoded blocks in the image slice may use this region division method to divide the decoded blocks into N regions.
  • the flag A can be a block-level flag, used to indicate that the current block can use this area division method to divide other areas of the current block into N areas.
  • the implementation methods of the above S502-A include but are not limited to the following:
  • Method 1 if the corresponding areas of each of the N first quantized coefficients in the current block are different, that is, when any two first quantized coefficients do not intersect in the corresponding areas of the current block, the decoder
  • the non-zero quantization area except the N first quantization coefficients in the current block can be divided into N areas, and then these N areas are allocated to the N first quantization coefficients one by one, and then the N first quantization coefficients are obtained.
  • the area corresponding to each first quantization coefficient in the current block if the corresponding areas of each of the N first quantized coefficients in the current block are different, that is, when any two first quantized coefficients do not intersect in the corresponding areas of the current block.
  • Method 2 determine the area corresponding to each of the N first quantization coefficients in the current block through calculation, that is, the above S502-A includes the following steps of S502-A1 and S502-A2:
  • the decoder determines the first value based on the scan index of the i-th first quantized coefficient, the number of first quantized coefficients in the current block, and the first threshold; and then determines the first scan index based on the first value. .
  • the embodiment of the present application does not limit the method of determining the first value based on the scan index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block, and the first threshold. For example, add the scan index of the i-th first quantization coefficient to the first preset value to obtain the first sum; subtract the first threshold from the second preset value to obtain the first difference; add the first The sum value is multiplied by the first difference value to obtain the first product; after the first product is added to the number of first quantization coefficients in the current block, the third preset value is subtracted to obtain the first numerical value.
  • Embodiments of the present application do not limit the manner in which the decoder determines the second value based on the number of quantization coefficients of the current block.
  • the number of quantization coefficients of the current block is determined as the second value.
  • the difference between the number of quantization coefficients of the current block and the fourth preset value is determined as the second value.
  • the embodiments of this application do not limit the specific value of the fourth preset value, which is determined based on actual needs.
  • the above describes the process of determining the first scan index.
  • the following describes the determination process of the second scan index.
  • the embodiment of the present application does not limit the specific method of determining the second scan index according to the scan index of the i-th first quantized coefficient, the number of first quantized coefficients in the current block, and the first threshold in the above S502-A21. .
  • e is the fifth preset value.
  • the embodiment of the present application does not limit the specific value of the fifth preset value mentioned above.
  • the fifth preset value e 1.
  • the above formula (7) can be expressed as the following formula (8):
  • the decoder determines the first scan index START i and the second scan index END i corresponding to the i-th first quantization coefficient according to the above method. Then, according to the scan order of the current block, the first scan index and the second scan index in the current block are The area within the second scan index is determined to be the area corresponding to the i-th first quantization coefficient in the current block.
  • the above-mentioned determination of the N first quantization coefficients and the area corresponding to each of the N first quantization coefficients in the current block is performed. introduce.
  • the two quantization coefficients in the upper left corner area of the current block are determined as two first quantization coefficients.
  • these two first quantization coefficients are the position indexes in the current block.
  • the N first quantization coefficients of the current block are located in the upper left corner area of the current block.
  • the N first quantization coefficients of the current block are scattered in The entire area of the current block, for example, the two first quantization coefficients in Figure 8 are the quantization coefficients at position index 0 and position index 1.
  • This embodiment of the present application concentrates the N first quantization coefficients of the current block on the current block. In the upper left corner area, since the value of the quantization coefficient in the upper left corner area is larger, when hiding the quantization coefficient in the upper left corner area, the hiding effect of the first characteristic of the quantization coefficient can be effectively improved, thereby effectively reducing the encoding cost.
  • the decoder determines the area corresponding to each of the N first quantization coefficients in the current block, and then performs the following step S503.
  • the encoding end hides the first characteristic of the i-th second quantization coefficient, obtains the i-th first quantization coefficient, and encodes the i-th first quantization coefficient to The encoding cost is reduced, and at the same time, the second characteristic of the area corresponding to the i-th first quantized coefficient in the current block is used to indicate the first characteristic of the i-th second quantized coefficient.
  • the decoder when decoding the i-th first quantized coefficient, the decoder first determines the area corresponding to the i-th first quantized coefficient in the current block according to the above method, and then, based on the i-th first quantized coefficient, determines the area corresponding to the i-th first quantized coefficient in the current block.
  • the second characteristic of the corresponding area in determines the first characteristic of the i-th second quantization coefficient being hidden, and then determines the i-th second quantization coefficient based on the first characteristic of the i-th second quantization coefficient and the i-th first quantization coefficient.
  • the second quantization coefficient when decoding the i-th first quantized coefficient, the decoder first determines the area corresponding to the i-th first quantized coefficient in the current block according to the above method, and then, based on the i-th first quantized coefficient, determines the area corresponding to the i-th first quantized coefficient in the current block.
  • the second characteristic of the corresponding area in determine
  • the above-mentioned second characteristic may be a binary characteristic, such as 0 or 1. That is to say, in this embodiment of the present application, the first characteristic of the i-th second quantization coefficient can be determined based on the binarization characteristic (0 or 1) of the area corresponding to the i-th first quantization coefficient in the current block. For example, as shown in Figure 7, according to the binarization characteristics corresponding to the area [2, 16], the first characteristic of the second quantization coefficient at position index 0 is determined. According to the binarization characteristics corresponding to the area [17, 21], the first characteristic is determined. First characteristic of the second quantized coefficient at position index 1.
  • the embodiments of the present application do not limit the first characteristic and the second characteristic.
  • the first characteristic and the second characteristic may be the same.
  • the first characteristic is different from the second characteristic.
  • the first characteristic is the sign of the i-th second quantization coefficient
  • the second characteristic may be the sign or parity of the corresponding area of the i-th second quantization coefficient in the current block.
  • the second characteristic of a region can be understood as the second characteristic corresponding to the quantization coefficient included in the region.
  • the parity of the region is the quantization coefficient in the region.
  • the number parity or the parity of the absolute value sum, or the parity of other characteristics of the quantized coefficients in the region is the second characteristic corresponding to the quantization coefficient included in the region.
  • the parity of the region can be understood as the parity of the sum of the number or absolute values of the quantized coefficients in the region.
  • Example 1 if the parity of the i-th second quantized coefficient is identified by the parity of the sum of the first absolute values of the quantized coefficients included in the region, that is, the parity of the region is the parity of the i-th quantized coefficient in the region.
  • the parity of a sum of absolute values includes: determining the parity of the i-th second quantization coefficient based on the parity of the first sum of absolute values of the quantization coefficients in the region.
  • the first absolute value of the quantized coefficient is part or all of the absolute value of the quantized coefficient.
  • the first absolute value is a part of the absolute value of the quantized coefficient that is less than 16.
  • the absolute value of the quantization coefficient is indicated by one or more identifiers. If the absolute value of the quantization coefficient is greater than 15, the absolute value of the quantization coefficient also includes the part exceeding 15.
  • the entire absolute value of the quantized coefficient refers to the entire decoded absolute value of the quantized coefficient, including the value of each identification bit. If the absolute value of the quantized coefficient is greater than 15, it will also Includes values with more than 15 parts.
  • part of the absolute value of the absolute value of the quantization coefficient refers to the value of all or part of the identification bits, for example, the decoding end is based on the sum of the absolute values of the values of identification 1 to identification 5 of the quantization coefficient in the area. Parity, determines the parity of the i-th second quantization coefficient.
  • the i-th second quantized coefficient is determined to be an even number.
  • Example 1 if the parity of the i-th second quantized coefficient is inconsistent with the parity of the sum of the first absolute values of the quantized coefficients in the region, the encoding end will The parity of at least one coefficient is modified. For example, if the i-th second quantization coefficient is an odd number, and the sum of the first absolute values of the quantization coefficients in the area is an even number, at this time, add 1 or subtract 1 to the smallest quantization coefficient among the quantization coefficients in the area, so as to The sum of the first absolute values of the quantization coefficients in this area is modified to an odd number.
  • the i-th second quantization coefficient is an even number
  • the sum of the first absolute values of the quantization coefficients in the area is an odd number
  • Example 2 if the parity of the area is the parity of the number of target quantization coefficients in the area, at this time, the above S503-A includes: determining the target quantization coefficient in the area, and based on the target quantization coefficient in the area The parity of the number determines the parity of the i-th second quantization coefficient.
  • the above-mentioned target quantization coefficient is any one of a non-zero quantization coefficient in the region, a non-zero quantization coefficient with an even value, a quantization coefficient with an even value, or a quantization coefficient with an odd value.
  • the parity of the i-th second quantization coefficient can be determined according to the parity of the number of non-zero quantization coefficients in the area.
  • the i-th second quantization coefficient is determined to be an even number.
  • a zero quantization coefficient in the area can be adjusted to 1, or the area can be adjusted to 1.
  • the value of the smallest quantization coefficient in is adjusted to 0 so that the number of non-zero quantization coefficients in this area is an even number.
  • the i-th quantization coefficient can be determined based on the parity of the number of non-zero quantization coefficients with an even number in the area. Parity of two quantized coefficients.
  • the i-th second quantization coefficient is determined to be an odd number.
  • the encoding end will A coefficient is modified. For example, if the i-th second quantization coefficient is an odd number, and the number of non-zero quantization coefficients with even values in the area is an even number, then one zero quantization coefficient in the area can be adjusted to 2, or, Add 1 or subtract 1 to the value of the smallest non-zero quantization coefficient in the area, so that the number of non-zero quantization coefficients with even values in the area is an odd number.
  • one zero quantization coefficient in the area can be adjusted to 2, or , add 1 or subtract 1 to the value of the smallest non-zero quantization coefficient in the area, so that the number of non-zero quantization coefficients in the area is an even number.
  • the i-th second quantization coefficient can be determined based on the parity of the number of quantization coefficients with an even number in the region. parity.
  • the quantization coefficients with an even number include quantization coefficients with a value of 0.
  • the i-th second quantization coefficient is determined to be an odd number.
  • the i-th second quantization coefficient is determined to be an even number.
  • the coding end will to modify. For example, if the i-th second quantization coefficient is an odd number, and the number of quantization coefficients with even values in the area is an even number, then a zero quantization coefficient in the area can be adjusted to 1, or the The smallest non-zero quantization coefficient in the area is adjusted to 0, so that the number of quantization coefficients with even values in the area is an odd number.
  • a zero quantization coefficient in the area can be adjusted to 1, or, The smallest non-zero quantization coefficient in this area is adjusted to 0 so that the number of quantization coefficients in this area is an even number.
  • the i-th second quantization coefficient can be determined based on the parity of the number of quantization coefficients with an odd value in the area. Parity.
  • the i-th second quantization coefficient is determined to be an odd number.
  • the i-th second quantization coefficient is determined to be an even number.
  • the coding end will to modify. For example, if the i-th second quantization coefficient is an odd number, and the number of quantization coefficients with odd values in the area is an even number, then a zero quantization coefficient in the area can be adjusted to 1, or the The smallest non-zero quantization coefficient in the area is adjusted to 0 or plus 1 or minus 1, so that the number of quantization coefficients with odd values in the area is an odd number.
  • a zero quantization coefficient in the area can be adjusted to 1, or, The smallest non-zero quantization coefficient in the area is adjusted to 0 or plus 1 or minus 1 so that the number of quantization coefficients in the area is an even number.
  • the encoding end uses an adjustment method with minimum rate distortion cost to adjust at least one coefficient in the area.
  • the parity of the i-th second quantization coefficient is determined based on the parity of the preset feature corresponding to the region.
  • step S504 is performed.
  • the first characteristic of the i-th second quantization coefficient at the encoding end is hidden to obtain the i-th first quantization coefficient. Since the i-th second quantization coefficient has One characteristic is hidden, and therefore is identified by the second characteristic of the region corresponding to the i-th first quantization coefficient in the current block. In this way, when decoding, the decoder first decodes the code stream, determines the N first quantization coefficients in the current block, and determines the i-th first quantization coefficient among the N first quantization coefficients.
  • the area corresponding to the coefficient in the current block is then determined based on the area to determine the first hidden characteristic of the i-th second quantization coefficient.
  • the second quantized coefficient with the first characteristic can be reconstructed, that is, the reconstruction of the hidden coefficient with the first characteristic can be achieved.
  • the first characteristic is a sign
  • the i-th second quantization coefficient if the first characteristic is a sign, it can be determined based on the signs of the i-th first quantization coefficient and the i-th second quantization coefficient decoded above that the characteristic has a sign. The i-th second quantization coefficient.
  • the decoder determines the i-th second quantization coefficient based on the parity of the i-th first quantization coefficient and the i-th second quantization coefficient.
  • the decoder uses different methods to reconstruct the i-th second quantized coefficient according to the different parity of the i-th second quantized coefficient.
  • the i-th first quantization coefficient is operated using the first operation method to obtain the i-th second quantization coefficient.
  • the first operation mode used by the decoding end corresponds to the third operation mode used by the encoding end to determine the i-th first quantization coefficient.
  • the embodiments of the present application do not limit the specific forms of the above-mentioned first operation method and the third operation method, where the first operation method can be understood as the inverse operation of the third operation method.
  • Method 1 For non-zero quantized coefficients, if the third operation method adopted by the encoding end is to add one to the value of the i-th second quantized coefficient and divide it by two, it will be used as the i-th first quantized coefficient.
  • the first operation method adopted by the decoder is that the value of the i-th second quantization coefficient is equal to the i-th first quantization coefficient multiplied by two minus one.
  • the first operation method is as shown in formula (9):
  • C is the i-th second quantization coefficient
  • val is the i-th first quantization coefficient
  • the i-th second quantization coefficient is determined according to the first operation method shown in the above formula (9).
  • the i-th first quantization coefficient is 5, and the area corresponding to the i-th first quantization coefficient in the current block includes 5 pixels.
  • the quantization coefficients corresponding to these 5 pixels are obtained. They are: 6, 3, 2, 1, 1.
  • the parity of the i-th second quantization coefficient is determined based on the parity of the sum of the first absolute values of the quantization coefficients in this area.
  • the sum of the first absolute values of the five quantization coefficients in this area is 13, which is is an odd number, then the i-th second quantization coefficient is determined to be an odd number.
  • the i-th second quantization coefficient with an original value of 9 is hidden to 5 through the parity concealment technology of the embodiment of the present application, which can reduce the number of bits required for encoding and greatly reduce the encoding cost.
  • the second operation method is used to operate the i-th first quantization coefficient to obtain the i-th second quantization coefficient.
  • the second operation mode used by the decoding end corresponds to the fourth operation mode used by the encoding end to determine the i-th first quantization coefficient.
  • the fourth operation method adopted by the encoding end is to divide the value of the i-th second quantization coefficient by two, it is used as the i-th first quantization coefficient.
  • the second operation mode adopted by the decoder is that the value of the i-th second quantization coefficient is equal to the i-th first quantization coefficient multiplied by two.
  • the second operation method is as shown in formula (10):
  • C is the i-th second quantization coefficient
  • val is the i-th first quantization coefficient
  • the i-th second quantization coefficient is determined according to the second operation method shown in the above formula (10).
  • the i-th first quantization coefficient is 4, and the area of the i-th first quantization coefficient in the current block includes 5 pixels.
  • the quantization coefficients corresponding to these 5 pixels are: 6, 3, 1, 1, 1.
  • the parity of the i-th second quantization coefficient is determined based on the parity of the sum of the first absolute values of the quantization coefficients in this area.
  • the sum of the first absolute values of the five quantization coefficients in this area is 12, which is is an even number, then the i-th second quantization coefficient is determined to be an even number.
  • the i-th second quantization coefficient with an original value of 8 is processed into the i-th first quantization coefficient with a value of 4 through the method of the embodiment of the present application, which can reduce the number of bits required for encoding. Reduced encoding cost.
  • the decoder can determine the i-th second quantization coefficient in the following manner, that is, the above S504 includes the following steps:
  • the above-mentioned preset operation method includes multiplying the i-th first quantization coefficient by two, that is, multiplying the value of the i-th first quantization coefficient by two to obtain the operation result.
  • the i-th second quantization coefficient is obtained. For example, the sum of the operation result and the preset value is determined as the value of the i-th second quantization coefficient. . In some embodiments, this preset value is also called parity. If the i-th second quantization coefficient is an odd number, the default value is 1; if the i-th second quantization coefficient is an even number, the default value is 0.
  • the decoder can determine the i-th second quantization coefficient according to the following formula (11):
  • Quant[pos] on the right side of the equal sign is the i-th first quantization coefficient
  • Quant[pos] on the left side of the equal sign is the i-th second quantization coefficient obtained through reconstruction
  • the quantization coefficient Quant[pos] is obtained by decoding the code stream. If the quantization coefficient is the i-th first quantization coefficient, then the i-th second quantization coefficient is equal to Quant[pos] multiplied by 2. Then add the value corresponding to the parity.
  • the second quantization coefficient corresponding to each of the N first quantization coefficients, each second quantization coefficient in the current block, and other quantization coefficients whose parity is not hidden can be determined.
  • Quantization coefficient of the current block is determined.
  • the reconstruction value of the current block is determined based on the quantization coefficient of the current block.
  • the encoding end if the encoding end skips the transformation step, the residual value of the current block is directly quantized.
  • the decoding end performs inverse quantization on the quantization coefficient of the current block to obtain the residual value of the current block.
  • the intra prediction and/or inter prediction method is used to determine the prediction value of the current block, and the prediction value of the current block and the reconstruction value are added to obtain the reconstruction value of the current block.
  • the encoding end if the encoding end does not skip the transformation step, that is, the encoding end transforms the residual value of the current block to obtain the transform coefficient, and quantizes the transform coefficient.
  • the decoding end performs inverse quantization on the quantization coefficient of the current block to obtain the transform coefficient of the current block, and performs inverse transformation on the transform coefficient to obtain the residual value of the current block.
  • the intra prediction and/or inter prediction method is used to determine the prediction value of the current block, and the prediction value of the current block and the reconstruction value are added to obtain the reconstruction value of the current block.
  • the decoder decodes the code stream and determines the N first quantization coefficients in the current block.
  • the i-th first quantization coefficient among the N first quantization coefficients is the The quantized coefficient obtained by hiding the first characteristic of the i-th second quantized coefficient, then, determine the corresponding area of the i-th first quantized coefficient in the current block; according to the corresponding area of the i-th first quantized coefficient in the current block determine the first characteristic of the i-th second quantization coefficient based on the second characteristic of the area; determine the i-th second quantization coefficient based on the first characteristics of the i-th first quantization coefficient and the i-th second quantization coefficient.
  • the first characteristics of the N second quantization coefficients in the current block are hidden to obtain N first quantization coefficients, and the N first quantization coefficients are encoded during encoding, which can reduce the encoding requirements.
  • the number of bits reduces the cost of video compression.
  • Figure 9 is a schematic flowchart of a video decoding method provided by an embodiment of the present application.
  • the method in the embodiment of the present application includes:
  • the above-mentioned at least one flag is used to indicate whether the parity of the quantized coefficient is allowed to be hidden.
  • the at least one flag includes at least one of a sequence level flag, an image level flag, a slice level flag, a unit level flag, and a block level flag.
  • the decoder first decodes the code stream to obtain at least one of the above flags, and based on the at least one flag, determines whether the current block allows the parity of the quantization coefficient to be hidden.
  • the following steps S602 and S609 are performed, that is, the code stream is decoded to obtain the decoded information of the current block, and the decoded information includes the current block.
  • the quantization coefficient of the block At this time, since the quantization coefficient in the current block has not been parity hidden, a subsequent inverse quantization process is performed.
  • the decoded information of the current block includes the quantization coefficient in the current block.
  • the decoder first decodes identifiers 1 to 5, and then decodes the part where the absolute value of each quantized coefficient exceeds 15 in the scanning order from the last non-zero coefficient to the upper left corner of the transform block, and finally obtains the Each quantization coefficient. Therefore, in some embodiments, in the embodiments of the present application, the decoded information of the current block includes quantization coefficients whose absolute value does not exceed 15 parts.
  • the embodiment of the present application does not limit the method of determining the N first quantization coefficients of the current block.
  • the decoded information of the current block also includes the number of quantization coefficients of the current block.
  • the decoder can determine N first quantization coefficients based on the number of quantization coefficients of the current block.
  • the above-mentioned N first quantization parameters are located in the upper left corner area of the current block.
  • the area corresponding to the i-th first quantization coefficient in the current block is determined.
  • the scan index of the i-th first quantized coefficient is determined; based on the scan index and the number of first quantized coefficients in the current block, the area corresponding to the i-th first quantized coefficient in the current block is determined.
  • the decoding end may determine the scan index of the i-th first quantized coefficient according to the scanning order of the i-th first quantized coefficient among the N first quantized coefficients. For example, if the i-th first quantized coefficient is the j-th scanned quantized coefficient among the N first quantized coefficients, then the scan index of the i-th first quantized coefficient is determined to be N-j.
  • the first scan index and the second scan index are determined according to the scan index of the i-th first quantized coefficient, the number of first quantized coefficients in the current block, and the first threshold; according to the scan of the current block In sequence, the area within the first scan index and the second scan index in the current block is determined as the area corresponding to the i-th first quantization coefficient in the current block.
  • the parity concealment technology proposed in this application is limited. Specifically, if the area corresponding to the i-th first quantization coefficient in the current block meets the set preset conditions, it means that the parity concealment technology provided by the embodiment of the present application can be used in this area to obtain significant beneficial effects. This When , perform the following steps from S606 to S608. If the area does not meet the set preset conditions, it means that the parity hiding technology provided by the embodiment of the present application cannot achieve significant beneficial effects in this area. In this case, the following step S609 is performed.
  • the above preset conditions include at least one of the following conditions:
  • Condition 1 The number of non-zero quantization coefficients in this area is greater than the first value
  • Condition 2 In this area, the distance between the first non-zero quantization coefficient and the last non-zero quantization coefficient located in the scanning order is greater than the second value
  • Condition 3 In this area, the distance between the first non-zero quantization coefficient and the last quantization coefficient located in the scanning order is greater than the third value
  • Condition 4 In this area, the sum of the absolute values of the non-zero quantization coefficients is greater than the fourth value.
  • the above four conditions can also be combined with each other to form new constraints.
  • the embodiments of the present application do not limit the specific values of the above-mentioned first numerical value to the fourth numerical value, as long as the first numerical value to the fourth numerical value are all positive integers.
  • At least one of the first value, the second value, the third value and the fourth value is a fixed value.
  • At least one of the first value, the second value, the third value and the fourth value is a non-fixed value, that is, a value determined by the encoding end based on the current encoding information.
  • the encoding end writes the non-fixed value into the code stream.
  • the first characteristic (such as parity) of the quantization coefficient corresponding to the area is hidden, and the following step S606 is performed.
  • the parity of the i-th second quantization coefficient is determined based on the parity of the sum of the first absolute values of the region.
  • the parity of the i-th second quantization coefficient is determined based on the parity of the number of target quantization coefficients in the area.
  • the above-mentioned target quantization coefficient is any one of a non-zero quantization coefficient in the region, a non-zero quantization coefficient with an even value, a quantization coefficient with an even value, or a quantization coefficient with an odd value.
  • the i-th second quantization coefficient is an odd number
  • the i-th second quantization coefficient is an odd number
  • the i-th second quantization coefficient is an even number
  • the quantization coefficient of the current block whose parity is hidden is determined, and combined with the decoded other quantization coefficients of the current block whose parity is not hidden, the quantization coefficient of the current block is obtained.
  • S609 Determine the quantization coefficient of the current block according to the decoded information of the current block.
  • the quantization coefficient decoded in the code stream is used as the final quantization coefficient of the current block.
  • the quantization coefficient of the current block is determined, and the reconstruction value of the current block is determined in the following two ways.
  • Method 1 If the encoding end skips the transformation step, the residual value of the current block is directly quantized. Correspondingly, the decoding end performs inverse quantization on the quantization coefficient of the current block to obtain the residual value of the current block. In addition, the intra prediction and/or inter prediction method is used to determine the prediction value of the current block, and the prediction value of the current block and the reconstruction value are added to obtain the reconstruction value of the current block.
  • Method 2 if the encoding end does not skip the transformation step, that is, the encoding end transforms the residual value of the current block to obtain the transform coefficient, and quantizes the transform coefficient.
  • the decoding end performs inverse quantization on the quantization coefficient of the current block to obtain the transform coefficient of the current block, and performs inverse transformation on the transform coefficient to obtain the residual value of the current block.
  • the intra prediction and/or inter prediction method is used to determine the prediction value of the current block, and the prediction value of the current block and the reconstruction value are added to obtain the reconstruction value of the current block.
  • preset conditions are set for the parity hiding technology. During decoding, it is first determined whether the area meets the preset conditions. If the area meets the preset conditions, it is determined that the parity of the quantization coefficient corresponding to the area is hidden, and then The parity concealment technology proposed in this application is used to decode the first quantization coefficient in the current block to improve decoding accuracy.
  • SBBSIZE indicates the size of each area.
  • the example SBBSIZE is 16.
  • the variables SUBSIZE and HPCTHRESH are used to identify the size of each area of the current block.
  • HPCTHRESH is used to identify the open parity hiding in each area. The number of non-zero coefficients in the technically required region is greater than a certain threshold.
  • the SBBSIZE size of each region is 16.
  • SBBTHRESH is used to identify that the number of non-zero coefficients in each area required to turn on the parity hiding technology is greater than a certain threshold, and the exemplary threshold is 4.
  • remainder represents the part of the quantized coefficient whose absolute value is greater than 15, and sign represents the sign of the quantized coefficient, that is, the plus or minus sign.
  • the decoder when decoding the first quantized coefficient, the decoder first determines whether the area corresponding to the first quantized coefficient meets the preset conditions, so as to determine whether the second quantized coefficient corresponding to the area uses the parity concealment provided by the present application. Whether the parity concealment technology can bring significant beneficial technical effects when decoding, and when it is determined that the parity concealment technology has significant beneficial effects, the technical solution of the present application is used to decode the first quantization coefficient, thereby improving decoding reliability.
  • the video decoding method involved in the embodiment of the present application is described above. On this basis, the video decoding method involved in the present application is described below with respect to the encoding end.
  • FIG 10 is a schematic flowchart of a video encoding method provided by an embodiment of the present application.
  • the execution subject of the embodiment of the present application may be the encoder shown in the above-mentioned Figure 1 and Figure 2.
  • the method in the embodiment of this application includes:
  • the coding end in order to reduce the coding cost, hides the first characteristics of the N second quantization coefficients in the current block to obtain N first quantization coefficients. For example, the coding end hides the i-th second quantization coefficient. The first characteristic of the coefficient is hidden, and the i-th first quantized coefficient is obtained. In this way, during encoding, the encoding end encodes the N first quantization coefficients instead of encoding the N second quantization coefficients. Since the N first quantization coefficients are obtained by hiding the first characteristics of the N second quantization coefficients, the coded values of the N first quantized coefficients are smaller than the N second quantized coefficients, so that the coded values are smaller. When encoding the N first quantization coefficients, fewer bits can be used, thereby reducing the encoding cost.
  • the above-mentioned second quantized coefficient is obtained by quantizing the transform coefficient.
  • the encoding end predicts the current block to obtain the predicted value of the current block, and subtracts the original value of the current block from the predicted value to obtain the residual value of the current block.
  • the encoding end transforms the residual value to obtain the transform coefficient of the current block, and then quantizes the transform coefficient to obtain the second quantized coefficient.
  • the above-mentioned second quantization coefficient is obtained by quantizing the residual value.
  • the encoding end predicts the current block to obtain the predicted value of the current block, and subtracts the original value of the current block from the predicted value to obtain the residual value of the current block.
  • the encoding end quantizes the residual value to obtain the second quantization coefficient.
  • N second quantization coefficients are coefficients at four positions with indexes 48, 32, 16 and 0.
  • the transformation causes the energy of the current block to be mainly concentrated in the upper left corner area, that is, the non-zero quantization coefficients of the current block are mainly concentrated in the upper left corner area of the current block, and the quantization coefficients in the lower right corner area of the current block are mainly concentrated in the upper left corner area of the current block.
  • the coefficient is usually 0.
  • the N second quantization parameters in this embodiment of the present application are located in the upper left corner area of the current block.
  • the N second quantization coefficients are quantization coefficients at position indexes 0, 1, 2, 4, etc.
  • the methods for determining the N second quantization coefficients of the current block include but are not limited to the following:
  • the positions of the N second quantization coefficients in the current block are preset or default.
  • Method 2 Determine the N second quantization coefficients of the current block through S701-A and S701-B as follows:
  • S701-B Determine N second quantization coefficients according to the number of quantization coefficients of the current block.
  • the number of quantization coefficients of the current block described in S701-A refers to the number of quantization coefficients that need to be encoded in the current block.
  • the encoding end starts from the quantization at position index 21 in the current block.
  • the coefficients start encoding toward the quantized coefficient at position index 0 in the upper left corner.
  • the total number of quantized coefficients that need to be encoded is 22. Therefore, it can be determined that the number of quantized coefficients of the current block is 22.
  • the encoding cost is smaller. At this time, the encoding end can directly encode the smaller number of quantization coefficients without concealing them. If the current block includes a large number of quantization coefficients, the coding cost at the encoding end is high. At this time, in order to reduce the coding cost, the first characteristics of some of the quantization coefficients in the current block can be hidden to reduce the coding cost. It can be seen that the number of quantization coefficients included in the current block will affect the encoding cost. Therefore, in the second method, the N second quantization coefficients in the current block are determined by the number of quantization coefficients included in the current block. coefficient to further reduce the coding cost.
  • the encoding end determines the number of quantization coefficients of the current block, it determines the N second quantization coefficients of the current block based on the number of quantization coefficients of the current block.
  • a quantization coefficient located in the upper left corner of the current block is determined as the second quantization coefficient.
  • two adjacent quantization coefficients located in the upper left corner of the current block are determined as second quantization coefficients respectively, and two second quantization coefficients are obtained.
  • two adjacent quantization coefficients may be spatially adjacent quantization coefficients.
  • two adjacent quantization coefficients are two adjacent quantization coefficients in scanning order.
  • the encoding end writes the number of quantization coefficients of the current block into the code stream.
  • N second quantization coefficients can be determined through the following steps S701-B1 to S701-B3:
  • S701-B2. Determine the number of second quantization coefficients in the current block according to the number of quantization coefficients in the current block and the first threshold;
  • the encoding end can calculate the number of second quantization coefficients in the current block based on the number of quantization coefficients in the current block, and then determine the N number of second quantization coefficients in the current block based on the number N of second quantization coefficients.
  • the second quantization coefficient can be calculated using the number of second quantization coefficients in the current block based on the number of quantization coefficients in the current block, and then determine the N number of second quantization coefficients in the current block based on the number N of second quantization coefficients. The second quantization coefficient.
  • the encoding end determines the first threshold, and then determines the number N of second quantization coefficients in the current block based on the first threshold and the number of quantization coefficients of the current block determined above, and then changes the upper left corner of the current block to The N quantization coefficients in the region are determined as N second quantization coefficients.
  • the embodiment of the present application does not limit the method of determining the first threshold in S701-B1.
  • the above-mentioned first threshold is a preset value or a default value, so that the encoding end can determine the preset value or default value as the first threshold.
  • the embodiment of the present application does not limit the specific value of the first threshold, for example, it may be 16, 8, 4, etc.
  • S701-B2 is executed to determine the number of second quantization coefficients in the current block based on the number of quantization coefficients of the current block and the first threshold.
  • the embodiment of this application does not limit the specific implementation of the above S701-B2.
  • the integer part of the ratio of the number of quantization coefficients of the current block and the first threshold is determined as the number of second quantization coefficients in the current block.
  • the rounded value of the ratio of the number of quantization coefficients of the current block to the first threshold is determined as the number of second quantization coefficients in the current block.
  • a value obtained by taking the ratio of the number of quantization coefficients of the current block and the first threshold upward is determined as the number of the second quantization coefficients in the current block.
  • the number of second quantization coefficients in the current block is determined.
  • the above method after determining the number N of second quantization coefficients in the current block, execute the above S701-B3 to convert the N number of second quantization coefficients in the upper left corner area of the current block according to the number of second quantization coefficients in the current block.
  • the quantization coefficient is determined as N second quantization coefficients.
  • any N quantization coefficients in the upper left corner area of the current block are determined as N second quantization coefficients.
  • the N second quantization coefficients are N quantization coefficients that are spatially adjacent or partially adjacent or not adjacent in the upper left corner area of the current block.
  • N quantization coefficients in the upper left corner area of the current block are determined as N second quantization coefficients according to the scanning order.
  • N quantization coefficients adjacent in decoding order in the upper left corner area of the current block are determined as N second quantization coefficients.
  • At least one flag may be used to indicate whether the current block is allowed to use the technology of hiding the first characteristic of the quantization coefficient provided by the embodiment of the present application.
  • the technology of hiding the first characteristic of the quantization coefficient provided by the embodiments of the present application is also called the first characteristic hiding technology.
  • the at least one flag set may be a flag of different levels, used to indicate whether the corresponding level allows the first characteristic of the quantized coefficient to be hidden.
  • the at least one flag includes at least one of a sequence-level flag, an image-level flag, a slice-level flag, a unit-level flag, and a block-level flag.
  • the above-mentioned at least one flag includes a sequence-level flag, which is used to indicate whether the current sequence allows the first characteristic of the quantized coefficient to be hidden. For example, if the value of the sequence-level flag is 1, it indicates that the current sequence allows the first characteristic of the quantized coefficient to be hidden; if the value of the sequence-level flag is 0, it indicates that the current sequence does not allow the first characteristic of the quantized coefficient. hidden.
  • the sequence-level flag may be located in the sequence header.
  • the above-mentioned at least one flag includes an image-level flag, which is used to indicate whether the current image allows the first characteristic of the quantized coefficient to be hidden. For example, if the value of the image-level flag is 1, it indicates that the current image allows the first characteristic of the quantized coefficient to be hidden; if the value of the image-level flag is 0, it indicates that the current image does not allow the first characteristic of the quantized coefficient. hidden.
  • the image-level flag may be located in the picture header.
  • the above-mentioned at least one flag includes a slice-level flag, which is used to indicate whether the current slice (slice) allows the first characteristic of the quantized coefficient to be hidden. For example, if the value of the slice-level flag is 1, it indicates that the current slice allows the first characteristic of the quantized coefficient to be hidden; if the value of the slice-level flag is 0, it indicates that the current slice does not allow the first characteristic of the quantized coefficient. hidden.
  • the slice-level flag may be located in the slice header.
  • the above-mentioned at least one flag includes a unit-level flag, which is used to indicate whether the current CTU allows the first characteristic of the quantized coefficient to be hidden. For example, if the value of the unit-level flag is 1, it indicates that the current CTU allows the first characteristic of the quantized coefficient to be hidden; if the value of the unit-level flag is 0, it indicates that the current CTU does not allow the first characteristic of the quantized coefficient. hidden.
  • the above-mentioned at least one flag includes a block-level flag, which is used to indicate whether the current block allows the first characteristic of the quantized coefficient to be hidden. For example, if the value of the block-level flag is 1, it indicates that the current block allows the first characteristic of the quantized coefficient to be hidden; if the value of the block-level flag is 0, it indicates that the current block does not allow the first characteristic of the quantized coefficient. hidden.
  • the encoding end first obtains the above-mentioned at least one flag, and determines whether the current block allows the parity of the quantized coefficient to be hidden based on the at least one flag. If it is determined based on at least one of the above flags that the current block does not allow the first characteristic of the quantized coefficient to be hidden, then the method in the embodiment of the present application is skipped. If it is determined based on at least one of the above flags that the current block is allowed to use the first feature hiding technology provided by the embodiment of the present application, then the method of the embodiment of the present application is executed.
  • the first feature hiding technology provided by the embodiments of the present application is mutually exclusive with the target transformation method, where the target transformation method includes secondary transformation or multiple transformations.
  • the encoding end determines that the current block is transformed using the target transformation method, it skips the technical solution provided by the embodiment of the present application.
  • the first characteristic of each second quantization coefficient among the N second quantization coefficients is hidden, and the process of obtaining the corresponding first quantization coefficient is the same.
  • N second quantization coefficients are used here.
  • the i-th second quantization coefficient among the coefficients is taken as an example for explanation.
  • the first characteristic of the i-th second quantized coefficient is hidden, the i-th first quantized coefficient is obtained, and the i-th first quantized coefficient is encoded into the code stream, and The i-th second quantization coefficient is not encoded into the code stream. Since the i-th first quantized coefficient is usually smaller than the i-th second quantized coefficient, therefore, encoding the i-th first quantized coefficient requires fewer bits than encoding the i-th second quantized coefficient. This reduces the encoding cost.
  • the embodiment of the present application does not limit the first characteristic of the second quantization coefficient.
  • the first characteristic is the sign of the second quantization coefficient.
  • the first characteristic is the parity of the second quantization coefficient.
  • the first characteristic of the i-th second quantization coefficient is hidden, and obtaining the i-th first quantization coefficient includes the following steps: :
  • the parity of the i-th second quantization coefficient is identified by the parity corresponding to the area corresponding to the i-th second quantization coefficient in the current block.
  • the embodiment of the present application performs parity hiding on the i-th second quantization coefficient, and the method of obtaining the i-th first quantization coefficient is not limited.
  • different methods can be selected to determine the i-th first quantization coefficient according to the parity of the i-th second quantization coefficient, as shown in case 1 and case 2.
  • the third operation method is used to operate the second quantization coefficient to obtain the i-th first quantization coefficient.
  • the third operation mode includes that the i-th first quantization coefficient is equal to the value of the second quantization coefficient plus one divided by two.
  • A is the i-th second quantization coefficient
  • val is the i-th first quantization coefficient
  • the i-th second quantization coefficient is an odd number, perform parity hiding on the i-th second quantization coefficient according to the third operation method shown in the above formula (12) to obtain the i-th first Quantization coefficient. For example, if the value of the i-th second quantization coefficient is 9, then the value of the i-th first quantization coefficient is determined to be 5 according to the above formula (12).
  • the encoded value 5 can reduce the number of bits compared to the encoded value 9, Reduce encoding costs.
  • the fourth operation method is used to operate the i-th second quantization coefficient to obtain the i-th first quantization coefficient.
  • the fourth operation mode includes the i-th first quantization coefficient being equal to the value of the i-th second quantization coefficient divided by two.
  • the i-th second quantization coefficient is an even number, perform parity hiding on the i-th second quantization coefficient according to the fourth operation method shown in the above formula (13), and obtain the i-th first Quantization coefficient. For example, if the value of the i-th second quantization coefficient is 10, then the value of the i-th first quantization coefficient is determined to be 5 according to the above formula (13).
  • the encoded value 5 can reduce the number of bits compared to the encoded value 10, Reduce encoding costs.
  • the encoding end may use a preset operation method to operate on the i-th second quantization coefficient according to the parity of the i-th second quantization coefficient to obtain the i-th first quantization coefficient.
  • the preset operation method is the value of the i-th second quantization coefficient divided by a positive integer greater than 1.
  • the preset operation method includes dividing the value of the i-th second quantization coefficient by two and rounding, where rounding can be understood as a quotient operation.
  • rounding can be understood as a quotient operation.
  • the value of the i-th second quantization coefficient is 7, and dividing by 7 Take the value 2 as 3.
  • the encoding end determines the i-th first quantization coefficient through the following formula (14):
  • Q represents the i-th second quantization coefficient
  • Q b represents the i-th first quantization coefficient
  • "//" represents the rounding operation
  • the parity concealment is performed through the above operation to obtain the i-th first quantized coefficient.
  • the absolute value of the i-th first quantized coefficient is smaller than the i-th second quantized coefficient.
  • the absolute value of the quantization coefficient requires fewer bits during encoding, thereby reducing the encoding cost. For example, when the i-th second quantization coefficient is 10, you only need to encode 5. For another example, when the i-th second quantization coefficient is 21, you only need to encode 10, which greatly reduces the coding required. Number of bits.
  • the i-th first quantization coefficient is encoded to obtain a code stream.
  • the first characteristic of the i-th second quantization coefficient is identified by the second characteristic of the area corresponding to the i-th second quantization coefficient in the current block.
  • a binary characteristic (0 or 1) of the area corresponding to the i-th second quantization coefficient in the current block is used to indicate the parity of the i-th second quantization coefficient.
  • the parity of the ith second quantization coefficient is indicated by the parity of this region.
  • the parity of the region can be understood as the parity of the sum of the number or absolute values of the quantized coefficients in the region.
  • the parity of the region may be the parity of the minimum quantization coefficient in the region, the maximum quantization coefficient in the region, the sum of absolute values of the region, the number of target quantization coefficients in the region, and so on.
  • Embodiments of the present application use the parity of the region to indicate the parity of the i-th second quantization coefficient. For example, use the parity of the region to be an odd number to indicate that the i-th second quantization coefficient is an odd number. Use the parity of the region to indicate the parity of the i-th second quantization coefficient. is an even number to indicate that the i-th second quantization coefficient is an even number.
  • the method in the embodiment of the present application further includes the following steps 1 and 2:
  • Step 1 Determine the area corresponding to the i-th second quantization coefficient in the current block
  • Step 2 Adjust the number or value of the quantization coefficients in the region so that the parity of the region is consistent with the parity of the second quantization coefficient.
  • the methods for determining the area corresponding to the i-th second quantization coefficient in the current block include but are not limited to the following:
  • Method 1 The area in the current block except the N second quantization coefficients is divided into N areas, and the divided N areas are allocated to the N second quantization coefficients one by one, thereby obtaining each of the N second quantization coefficients. The area corresponding to the second quantization coefficient in the current block.
  • Method 2 determine the area corresponding to the i-th second quantization coefficient in the current block based on the number of second quantization coefficients in the current block.
  • a scan index of the i-th first quantized coefficient is determined; and a region corresponding to the i-th first quantized coefficient in the current block is determined based on the scan index and the number of first quantized coefficients in the current block.
  • the scan index of the i-th second quantization coefficient is determined according to the scanning order of the i-th second quantization coefficient among the N second quantization coefficients.
  • the i-th second quantization coefficient is the j-th scanned quantization coefficient among the N second quantization coefficients, then determine the scan index of the i-th second quantization coefficient. is N-j.
  • the encoding end After the encoding end determines the scan index of the i-th first quantized coefficient, it determines the area corresponding to the i-th first quantized coefficient in the current block based on the scan index and the number of first quantized coefficients in the current block.
  • the first scan index and the second scan index are determined according to the scan index of the i-th second quantized coefficient, the number of second quantized coefficients in the current block, and the first threshold. ; According to the scanning order of the current block, determine the area within the first scan index and the second scan index in the current block as the i-th second quantization coefficient in the current block corresponding area.
  • the method of determining the first scan index includes: determining the first value according to the scan index of the i-th second quantization coefficient, the number of second quantization coefficients in the current block, and the first threshold. For example, add the scan index of the i-th second quantization coefficient to the first preset value to obtain the first sum; subtract the first threshold from the second preset value to obtain the first difference; add the first The sum is multiplied by the first difference to obtain the first product; the first product is added to the number of second quantization coefficients in the current block, and then the third preset value is subtracted to obtain the first numerical value. Next, the first scan index is determined according to the first value.
  • the second value is determined according to the number of quantization coefficients of the current block, for example, the difference between the number of quantization coefficients of the current block and the fourth preset value is determined as the second value, and then the second value is determined.
  • the minimum value among the first value and the second value is determined as the first scan index.
  • the method for determining the second scan index includes: subtracting the first threshold from the fifth preset value to obtain a second difference; and subtracting the scan index of the i-th second quantization coefficient from the second difference. Multiply to obtain a second product; add the second product to the number of second quantization coefficients in the current block to obtain a second scan index.
  • the encoding end determines the area corresponding to the i-th second quantization coefficient in the current block according to the above steps, and then determines the parity of the area, when it is inconsistent with the parity of the i-th second quantization coefficient. , then the number or value of the quantization coefficients in the area is adjusted so that the parity of the area is consistent with the parity of the i-th second quantization coefficient.
  • the way to adjust the area corresponding to the i-th second quantization coefficient in the current block includes at least the following situations:
  • step 2 above includes: adjusting the value of the region so that the value of the region is The parity of the sum of absolute values is consistent with the parity of the i-th second quantization coefficient.
  • the first absolute value of the quantized coefficient is part or all of the absolute value of the quantized coefficient.
  • the first absolute value of the quantized coefficient is an absolute value smaller than 15 parts.
  • the above situation 1 includes the following two examples:
  • Example 1 if the i-th second quantization coefficient is an odd number and the sum of the first absolute values of the region is an even number, adjust the value of the region so that the adjusted sum of the first absolute values of the region is odd number.
  • the minimum quantization coefficient in the area is added or subtracted by 1 to reduce the first absolute value in the area.
  • the sum of the values is modified to be an odd number.
  • Example 2 if the i-th second quantization coefficient is an even number and the sum of the first absolute values of the region is an odd number, adjust the value of the region so that the adjusted sum of the first absolute values of the region is an even number.
  • the i-th second quantization coefficient is an even number
  • the sum of the first absolute values of the area is an odd number.
  • the smallest quantization coefficient in the area is added or subtracted by 1 to reduce the first absolute value of the area. The sum is modified to an even number.
  • the above step 2 includes: adjusting the value of the area so that the target in the area The parity of the number of quantized coefficients is consistent with the parity of the i-th second quantized coefficient.
  • Example 2 above includes at least the following two examples:
  • Example 1 if the i-th second quantization coefficient is an odd number, and the number of target quantization coefficients in the area is an even number, then adjust the value of the area so that the adjusted number of target quantization coefficients in the area is an odd number.
  • Example 2 if the i-th second quantization coefficient is an even number, and the number of target quantization coefficients in the area is an odd number, adjust the value of the area so that the adjusted number of target quantization coefficients in the area is an even number.
  • the above-mentioned target quantization coefficient is any one of a non-zero quantization coefficient in the region, a non-zero quantization coefficient with an even value, a quantization coefficient with an even value, or a quantization coefficient with an odd value.
  • the encoding end modifies at least one coefficient in the area. For example, if the i-th second quantization coefficient is an odd number and the number of non-zero quantization coefficients in the area is an even number, then a zero quantization coefficient in the area can be adjusted to 1, or the smallest quantization coefficient in the area can be adjusted to 1. The value of one quantization coefficient of is adjusted to 0 so that the number of non-zero quantization coefficients in this area is an odd number.
  • a zero quantization coefficient in the area can be adjusted to 1, or the quantization coefficient in the area can be adjusted to 1.
  • the value of the smallest non-zero quantization coefficient is adjusted to 0 so that the number of non-zero quantization coefficients in this area is an even number.
  • the encoding end modifies at least one coefficient in the region. For example, if the i-th second quantization coefficient is an odd number, and the number of non-zero quantization coefficients with even values in the area is an even number, then one zero quantization coefficient in the area can be adjusted to 2, or, The value of the smallest non-zero quantization coefficient in the area is added or subtracted by 1, so that the number of non-zero quantization coefficients with even values in the area is an odd number.
  • the encoding end uses an adjustment method with the smallest rate distortion cost to adjust at least one coefficient in the area.
  • the encoding end modifies at least one coefficient in the region. For example, if the i-th second quantization coefficient is an odd number, and the number of quantization coefficients with even values in the area is an even number, then a zero quantization coefficient in the area can be adjusted to 1, or the area can be adjusted to 1. The smallest non-zero quantization coefficient in is adjusted to 0, so that the number of quantization coefficients with even values in the area is an odd number.
  • a zero quantization coefficient in the area can be adjusted to 1, or the The smallest non-zero quantization coefficient in the region is adjusted to 0 so that the number of quantization coefficients in the region is an even number.
  • the encoding end modifies at least one coefficient in the area. For example, if the i-th second quantization coefficient is an odd number, and the number of quantization coefficients with odd values in the area is an even number, then a zero quantization coefficient in the area can be adjusted to 1, or the area The smallest non-zero quantization coefficient in the area is adjusted to 0 or plus 1 or minus 1, so that the number of quantization coefficients with odd values in the area is an odd number.
  • a zero quantization coefficient in the area can be adjusted to 1, or the The smallest non-zero quantization coefficient in the area is adjusted to 0 or plus 1 or minus 1 so that the number of quantization coefficients in the area is an even number.
  • the parity hiding technology proposed in this application is implemented on the AVM reference software, the area size used is set to 16, and the threshold for the number of non-zero coefficients that enable parity hiding is 4.
  • the parity hiding technology of this application is enabled for the current area, the sum of the absolute values of the non-zero coefficients less than or equal to 15 in the current area is an odd number, which means that the last coefficient (i.e., the second quantization coefficient) in the scanning order of the area is an odd number.
  • being an even number means that the last coefficient (i.e., the second quantization coefficient) in the scanning order of this area is an even number.
  • the encoding performance of the YUV3 component under the full intra-frame AI configuration is improved to 0.21%/1.02%/1.05%.
  • the coding performance improvement of the YUV3 component under the random access RA configuration is 0.29%/0.63%/0.72%.
  • the encoding end determines N second quantization coefficients of the current block, and N is a positive integer; for the i-th second quantization coefficient among the N second quantization coefficients, the i-th second quantization coefficient is The first characteristics of the two quantized coefficients are hidden to obtain the i-th first quantized coefficient, where i is a positive integer less than or equal to N; the i-th first quantized coefficient is encoded to obtain a code stream. That is, in the embodiment of the present application, the encoding end hides the first characteristic of the second quantized coefficient to obtain the first quantized coefficient.
  • the first characteristic of the second quantization coefficient is identified by the second characteristic of the area corresponding to the second quantization coefficient, so that the decoding end determines the second quantization based on the second characteristic of the area corresponding to the second quantization coefficient. The first characteristic of the coefficient, and then achieving accurate reconstruction of the second quantized coefficient based on the first characteristic of the second quantized coefficient and the first quantized coefficient.
  • Figure 11 is a schematic flowchart of a video encoding method provided by an embodiment of the present application.
  • the first characteristic and the second characteristic are parity, as shown in Figure 11.
  • the method in this embodiment of the present application includes:
  • the above-mentioned at least one flag is used to indicate whether the parity of the quantized coefficient is allowed to be hidden.
  • At least one flag includes at least one of a sequence-level flag, an image-level flag, a slice-level flag, a unit-level flag, and a block-level flag.
  • step S802 If it is determined according to at least one flag that the parity of the quantization coefficient of the current block is allowed to be hidden, the following step S802 is performed.
  • step S807 are performed.
  • the parity concealment technology proposed in this application is limited. Specifically, if the current area meets the set preset conditions, it means that the area corresponding to the i-th second quantization coefficient in the current block can obtain significant beneficial effects by using the parity concealment technology provided by the embodiment of the present application. , at this time, perform the following steps of S805.
  • the above preset conditions include at least one of the following conditions:
  • Condition 1 the number of non-zero quantization coefficients in the area corresponding to the i-th second quantization coefficient in the current block is greater than the first value
  • Condition 2 In this area, the distance between the first non-zero quantization coefficient and the last non-zero quantization coefficient located in the scanning order is greater than the second value
  • Condition 3 In this area, the distance between the first non-zero quantization coefficient and the last quantization coefficient located in the scanning order is greater than the third value
  • Condition 4 In this area, the sum of the absolute values of the non-zero quantization coefficients is greater than the fourth value.
  • the above four conditions can also be combined with each other to form new constraints.
  • the embodiments of the present application do not limit the specific values of the above-mentioned first numerical value to the fourth numerical value, as long as the first numerical value to the fourth numerical value are all positive integers.
  • At least one of the first value, the second value, the third value and the fourth value is a fixed value.
  • At least one of the first value, the second value, the third value and the fourth value is a non-fixed value, that is, a value determined by the encoding end based on the current encoding information.
  • the encoding end writes the non-fixed value into the code stream, and the decoding end reads the value from the code stream.
  • the non-fixed value is parsed out.
  • the encoding end when encoding the second quantized coefficient, the encoding end first determines whether the area corresponding to the second quantized coefficient meets the preset conditions to determine whether the parity concealment technology provided by the present application can be used for encoding.
  • the technical solution of the present application is used to encode the second quantization coefficient to improve encoding reliability.
  • the size of the sequence numbers of the above-mentioned processes does not mean the order of execution.
  • the execution order of each process should be determined by its functions and internal logic, and should not be used in this application.
  • the implementation of the examples does not constitute any limitations.
  • the term "and/or" is only an association relationship describing associated objects, indicating that three relationships can exist. Specifically, A and/or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
  • the character "/" in this article generally indicates that the related objects are an "or" relationship.
  • Figure 12 is a schematic block diagram of a video decoding device provided by an embodiment of the present application.
  • the video decoding device 10 includes:
  • the decoding unit 11 is used to decode the code stream and determine the N first quantization coefficients of the current block.
  • the i-th first quantization coefficient among the N first quantization coefficients is the i-th first quantization coefficient in the current block.
  • the quantized coefficient obtained after hiding the first characteristic of the two quantized coefficients, the N is a positive integer, and the i is a positive integer less than or equal to N;
  • the area determination unit 12 is used to determine the area corresponding to the i-th first quantization coefficient in the current block
  • the characteristic determination unit 13 is configured to determine the first characteristic of the i-th second quantization coefficient according to the second characteristic of the area corresponding to the i-th first quantization coefficient in the current block;
  • the coefficient determination unit 14 is configured to determine the i-th second quantization coefficient according to the first characteristics of the i-th first quantization coefficient and the i-th second quantization coefficient.
  • the N first quantization coefficients are located in the upper left corner area of the current block.
  • the decoding unit 11 is specifically configured to decode the code stream to obtain the number of quantization coefficients of the current block; determine the N first ones according to the number of quantization coefficients of the current block. Quantization coefficient.
  • the decoding unit 11 is specifically configured to determine a first threshold; determine the number of first quantization coefficients in the current block according to the number of quantization coefficients of the current block and the first threshold. ; According to the number of first quantization coefficients in the current block, determine the N quantization coefficients in the upper left corner area of the current block as the N first quantization coefficients.
  • the decoding unit 11 is specifically configured to decode the code stream to obtain the first threshold.
  • the first threshold is a preset value.
  • the decoding unit 11 is specifically configured to determine an upward value of the ratio of the number of quantization coefficients of the current block to the first threshold as the first quantization value in the current block. The number of coefficients.
  • the decoding unit 11 is specifically configured to determine the N quantization coefficients in the upper left corner area of the current block as the N first quantization coefficients according to the scanning order.
  • the decoding unit 11 is specifically configured to determine the last N quantization coefficients in the current block located in the scanning order as the N first quantization coefficients.
  • the area determination unit 12 is specifically configured to determine the area corresponding to the i-th first quantization coefficient in the current block according to the number of first quantization coefficients in the current block.
  • the area determination unit 12 is specifically configured to determine the scan index of the i-th first quantization coefficient; determine the scan index according to the scan index and the number of first quantization coefficients in the current block. The area corresponding to the i-th first quantization coefficient in the current block.
  • the area determination unit 12 is specifically configured to determine the scanning order of the i-th first quantization coefficient according to the scanning order of the i-th first quantization coefficient among the N first quantization coefficients. index.
  • the area determination unit 12 is specifically configured to determine the i-th first quantized coefficient if it is the j-th scanned quantized coefficient among the N first quantized coefficients.
  • the scan index of the first quantized coefficient is N-j.
  • the area determination unit 12 is specifically configured to determine the i-th first quantization coefficient based on the scan index, the number of first quantization coefficients in the current block, and the first threshold.
  • a scan index and a second scan index according to the scan order of the current block, determine the area within the first scan index and the second scan index in the current block as the i-th first The area corresponding to the quantization coefficient in the current block.
  • the area determination unit 12 is specifically configured to determine the i-th first quantization coefficient based on the scan index, the number of first quantization coefficients in the current block, and the first threshold. A numerical value; determine the first scan index according to the first numerical value.
  • the area determination unit 12 is specifically configured to determine a second value according to the number of quantization coefficients of the current block; determine the minimum value of the first value and the second value as The first scan index.
  • the area determination unit 12 is specifically configured to add the scan index of the i-th first quantization coefficient to a first preset value to obtain a first sum; add the first threshold to the first preset value. Subtract the two preset values to obtain a first difference value; multiply the first sum value and the first difference value to obtain a first product; combine the first product with the first value in the current block After the numbers of quantization coefficients are added, the third preset value is subtracted to obtain the first value.
  • the area determination unit 12 is specifically configured to determine the difference between the number of quantization coefficients of the current block and the fourth preset value as the second value.
  • the area determination unit 12 is specifically configured to subtract the first threshold and the fifth preset value to obtain a second difference; and compare the scan index of the i-th first quantization coefficient with the Multiply the second difference to obtain a second product; add the second product to the number of first quantization coefficients in the current block to obtain the second scan index.
  • both the first characteristic and the second characteristic are parity
  • the characteristic determining unit 13 is specifically configured to determine the parity of the i-th second quantization coefficient according to the parity of the region.
  • the parity of the region is the parity of the sum of the number or absolute values of the quantization coefficients in the region; correspondingly, the coefficient determination unit 14 is specifically configured to calculate the i-th first quantization coefficient and the sum of the absolute values. The parity of the i-th second quantization coefficient is used to determine the i-th second quantization coefficient.
  • the characteristic determining unit 13 is specifically configured to determine the parity according to the first absolute value of the quantized coefficients in the region.
  • the parity of the sum of absolute values determines the parity of the i-th second quantized coefficient, and the first absolute value is part or all of the absolute value of the quantized coefficient.
  • the characteristic determination unit 13 is specifically configured to determine the target quantization coefficient in the region; according to the target The parity of the number of quantized coefficients determines the parity of the i-th second quantized coefficient.
  • the target quantization coefficient is any one of a non-zero quantization coefficient in the region, a non-zero quantization coefficient with an even value, a quantization coefficient with an even value, or a quantization coefficient with an odd value.
  • the characteristic determination unit 13 is specifically configured to perform an operation on the i-th first quantization coefficient using a preset operation method to obtain an operation result; according to the parity sum of the i-th second quantization coefficient As a result of the operation, the i-th second quantization coefficient is obtained.
  • the preset operation method includes multiplying the value of the i-th first quantization coefficient by two.
  • the characteristic determination unit 13 is specifically configured to determine the first characteristic of the i-th second quantization coefficient according to the region if the region meets a preset condition.
  • the preset conditions include at least one of the following:
  • the number of non-zero quantization coefficients in the region is greater than the first value
  • the distance between the first non-zero quantized coefficient and the last non-zero quantized coefficient located in the scanning order is greater than the second value
  • the distance between the first non-zero quantized coefficient and the last quantized coefficient located in the scanning order is greater than the third value
  • the sum of absolute values of the non-zero quantization coefficients is greater than the fourth numerical value.
  • the device embodiments and the method embodiments may correspond to each other, and similar descriptions may refer to the method embodiments. To avoid repetition, they will not be repeated here.
  • the video decoding device 10 shown in FIG. 12 may correspond to the corresponding subject in performing the method of the embodiment of the present application, and the aforementioned and other operations and/or functions of each unit in the video decoding device 10 are respectively to implement the method, etc. The corresponding processes in each method will not be repeated here for the sake of brevity.
  • Figure 13 is a schematic block diagram of a video encoding device provided by an embodiment of the present application.
  • the video encoding device 20 includes:
  • Determining unit 21 used to determine N second quantization coefficients of the current block, where N is a positive integer
  • the hiding unit 22 is configured to hide the first characteristic of the i-th second quantization coefficient among the N second quantization coefficients to obtain the i-th first quantization coefficient.
  • the i is a positive integer less than or equal to N;
  • Encoding unit 23 is used to encode the i-th first quantization coefficient to obtain a code stream.
  • the first characteristic of the i-th second quantization coefficient is transmitted through the i-th second quantization coefficient in the current
  • the second characteristic of the corresponding region in the block is identified.
  • the N second quantization coefficients are located in the upper left corner area of the current block.
  • the determining unit 21 is specifically configured to determine the number of quantization coefficients of the current block; and determine the N second quantization coefficients according to the number of quantization coefficients of the current block.
  • the determination unit 21 is specifically configured to determine a first threshold; determine the number of second quantization coefficients in the current block according to the number of quantization coefficients of the current block and the first threshold. ; According to the number of second quantization coefficients in the current block, determine the N quantization coefficients in the upper left corner area of the current block as the N second quantization coefficients.
  • the determination unit 21 is specifically configured to determine an upward value of the ratio of the number of quantization coefficients of the current block to the first threshold as the second quantization value in the current block. The number of coefficients.
  • the determination unit 21 is specifically configured to determine the N quantization coefficients in the upper left corner area of the current block as the N second quantization coefficients according to the scanning order.
  • the determination unit 21 is specifically configured to determine the last N quantization coefficients in the current block located in the scanning order as the N second quantization coefficients.
  • the first threshold is a preset value.
  • the encoding unit 23 is also used to write the first threshold into the code stream.
  • the encoding unit 23 is also used to write the number of quantization coefficients of the current block into the code stream.
  • both the first characteristic and the second characteristic are parity
  • the hiding unit 22 is specifically used to hide the parity of the i-th second quantization coefficient to obtain the i-th second quantization coefficient.
  • the first quantization coefficient, the parity of the i-th second quantization coefficient is identified by the parity of the region.
  • the hidden unit 22 is also used to determine the area corresponding to the i-th second quantization coefficient in the current block; if the parity of the area is equal to the parity of the second quantization coefficient, When the parity of the second quantization coefficient is inconsistent, the number or value of the quantization coefficient in the region is adjusted so that the parity of the region is consistent with the parity of the second quantization coefficient, and the parity of the region is the The parity of the number of quantized coefficients or the sum of absolute values in the region.
  • the hiding unit 22 is specifically configured to determine the area corresponding to the i-th second quantization coefficient in the current block according to the number of second quantization coefficients in the current block.
  • the hidden unit 22 is specifically configured to determine the scan index of the i-th second quantization coefficient; determine the scan index according to the scan index and the number of second quantization coefficients in the current block. The area corresponding to the i-th second quantization coefficient in the current block.
  • the hidden unit 22 is specifically configured to determine the scan index of the i-th second quantized coefficient according to the scanning order of the i-th second quantized coefficient among the N second quantized coefficients. .
  • the hidden unit 22 is specifically configured to determine the i-th second quantized coefficient if it is the j-th scanned quantized coefficient among the N second quantized coefficients.
  • the scan index of the second quantized coefficient is N-j.
  • the hidden unit 22 is specifically configured to determine the first value based on the scan index of the i-th second quantization coefficient, the number of second quantization coefficients in the current block, and the first threshold. Scan index and second scan index; according to the scan order of the current block, determine the area within the first scan index and the second scan index in the current block as the i-th second quantization The coefficient corresponds to the area in the current block.
  • the hidden unit 22 is specifically configured to determine the first value based on the scan index of the i-th second quantization coefficient, the number of second quantization coefficients in the current block, and the first threshold. Numerical value; determine the first scan index according to the first numerical value.
  • the hidden unit 22 is specifically configured to determine a second value according to the number of quantization coefficients of the current block; determine the minimum value of the first value and the second value as the The first scan index.
  • the hidden unit 22 is specifically configured to add the scan index of the i-th second quantization coefficient to the first preset value to obtain a first sum value; add the first threshold and the second Subtract the preset value to obtain a first difference value; multiply the first sum value and the first difference value to obtain a first product; combine the first product with the second quantization value in the current block After the numbers of coefficients are added, the third preset value is subtracted to obtain the first value.
  • the hiding unit 22 is specifically configured to determine the difference between the number of quantization coefficients of the current block and the fourth preset value as the second value.
  • the hidden unit 22 is specifically configured to subtract the first threshold and the fifth preset value to obtain a second difference; and compare the scan index of the i-th second quantization coefficient with the Multiply the second difference to obtain a second product; add the second product to the number of second quantization coefficients in the current block to obtain the second scan index.
  • the hidden unit 22 is specifically configured to perform quantization in the region. The value of the coefficient is adjusted so that the parity of the sum of the first absolute values of the quantized coefficients in the region is consistent with the parity of the second quantized coefficient.
  • the hidden unit 22 is also used to calculate the parity of the quantization coefficient in the region. The value is adjusted so that the parity of the number of target quantization coefficients in the region is consistent with the parity of the second quantization coefficient.
  • the hidden unit 22 is specifically configured to operate on the i-th second quantization coefficient using a preset operation method to obtain the i-th first quantization coefficient.
  • the preset operation method includes dividing the value of the i-th second quantization coefficient by two and rounding it to an integer.
  • the hiding unit 22 is specifically configured to hide the first characteristic of the i-th second quantization coefficient to obtain the i-th first quantization coefficient if the area satisfies a preset condition.
  • the preset conditions include at least one of the following:
  • the number of non-zero quantization coefficients in the region is greater than the first value
  • the distance between the first non-zero quantized coefficient and the last non-zero quantized coefficient located in the scanning order is greater than the second value
  • the distance between the first non-zero quantized coefficient and the last quantized coefficient located in the scanning order is greater than the third value
  • the sum of absolute values of the non-zero quantization coefficients is greater than the fourth numerical value.
  • the device embodiments and the method embodiments may correspond to each other, and similar descriptions may refer to the method embodiments. To avoid repetition, they will not be repeated here.
  • the video encoding device 20 shown in FIG. 13 may correspond to the corresponding subject in performing the method of the embodiment of the present application, and the aforementioned and other operations and/or functions of each unit in the video encoding device 20 are respectively to implement the method, etc. The corresponding processes in each method will not be repeated here for the sake of brevity.
  • the software unit may be located in a mature storage medium in this field such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, register, etc.
  • the storage medium is located in the memory, and the processor reads the information in the memory and completes the steps in the above method embodiment in combination with its hardware.
  • Figure 11 is a schematic block diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device 30 may be the video encoder or video decoder described in the embodiment of the present application.
  • the electronic device 30 may include:
  • Memory 33 and processor 32 the memory 33 is used to store the computer program 34 and transmit the program code 34 to the processor 32.
  • the processor 32 can call and run the computer program 34 from the memory 33 to implement the method in the embodiment of the present application.
  • the processor 32 may be configured to perform steps in the above method according to instructions in the computer program 34 .
  • the processor 32 may include but is not limited to:
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field Programmable Gate Array
  • the memory 33 includes but is not limited to:
  • Non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electrically removable memory. Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory. Volatile memory may be Random Access Memory (RAM), which is used as an external cache.
  • RAM Random Access Memory
  • RAM static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous dynamic random access memory
  • SDRAM double data rate synchronous dynamic random access memory
  • Double Data Rate SDRAM DDR SDRAM
  • ESDRAM enhanced synchronous dynamic random access memory
  • SLDRAM synchronous link dynamic random access memory
  • Direct Rambus RAM Direct Rambus RAM
  • the computer program 34 can be divided into one or more units, and the one or more units are stored in the memory 33 and executed by the processor 32 to complete the tasks provided by this application.
  • the one or more units may be a series of computer program instruction segments capable of completing specific functions. The instruction segments are used to describe the execution process of the computer program 34 in the electronic device 30 .
  • the electronic device 30 may also include:
  • Transceiver 33 the transceiver 33 can be connected to the processor 32 or the memory 33 .
  • the processor 32 can control the transceiver 33 to communicate with other devices. Specifically, it can send information or data to other devices, or receive information or data sent by other devices.
  • Transceiver 33 may include a transmitter and a receiver.
  • the transceiver 33 may further include an antenna, and the number of antennas may be one or more.
  • bus system where in addition to the data bus, the bus system also includes a power bus, a control bus and a status signal bus.
  • Figure 15 is a schematic block diagram of a video encoding and decoding system provided by an embodiment of the present application.
  • the video encoding and decoding system 40 may include: a video encoder 41 and a video decoder 42, where the video encoder 41 is used to perform the video encoding method involved in the embodiment of the present application, and the video decoder 42 is used to perform
  • the embodiment of the present application relates to a video decoding method.
  • This application also provides a computer storage medium on which a computer program is stored.
  • the computer program When the computer program is executed by a computer, the computer can perform the method of the above method embodiment.
  • embodiments of the present application also provide a computer program product containing instructions, which when executed by a computer causes the computer to perform the method of the above method embodiments.
  • This application also provides a code stream, which is obtained by the above video coding method.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted over a wired connection from a website, computer, server, or data center (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) to another website, computer, server or data center.
  • the computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center integrated with one or more available media.
  • the available media may be magnetic media (such as floppy disks, hard disks, magnetic tapes), optical media (such as digital video discs (DVD)), or semiconductor media (such as solid state disks (SSD)), etc.
  • the disclosed systems, devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or may be Integrated into another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • a unit described as a separate component may or may not be physically separate.
  • a component shown as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in various embodiments of the present application can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本申请实施例提供一种视频编解码方法、装置、设备、系统及存储介质,通过解码码流,确定当前块中的N个第一量化系数,N个第一量化系数中的第i个第一量化系数为对当前块中的第i个第二量化系数的第一特性进行隐藏后得到的量化系数,接着,确定第i个第一量化系数在当前块中对应的区域;根据第i个第一量化系数在当前块中对应的区域的第二特性,确定第i个第二量化系数的第一特性;根据第i个第一量化系数和第i个第二量化系数的第一特性,确定第i个第二量化系数。即本申请,对当前块中的N个第二量化系数的第一特性进行隐藏,得到N个第一量化系数,在编码时对N个第一量化系数进行编码,可以减少编码所需的比特数,降低视频压缩代价。

Description

视频编解码方法、装置、设备、系统及存储介质 技术领域
本申请涉及视频编解码技术领域,尤其涉及一种视频编解码方法、装置、设备、系统及存储介质。
背景技术
数字视频技术可以并入多种视频装置中,例如数字电视、智能手机、计算机、电子阅读器或视频播放器等。随着视频技术的发展,视频数据所包括的数据量较大,为了便于视频数据的传输,视频装置执行视频压缩技术,以使视频数据更加有效的传输或存储。
在视频压缩过程中为了便于编码,对变换系数进行量化,量化的目的是将变换系数进行缩放,从而使得编码系数时消耗的比特数减少。但是,目前的量化方法,编码代价较大。
发明内容
本申请实施例提供了一种视频编解码方法、装置、设备、系统及存储介质,以降低量化编码代价。
第一方面,本申请提供了一种视频解码方法,包括:
解码码流,确定当前块的N个第一量化系数,所述N个第一量化系数中的第i个第一量化系数为对所述当前块中的第i个第二量化系数的第一特性进行隐藏后得到的量化系数,所述N为正整数,所述i为小于或等于N的正整数;
确定所述第i个第一量化系数在所述当前块中对应的区域;
根据所述第i个第一量化系数在所述当前块中对应的区域的第二特性,确定所述第i个第二量化系数的第一特性;
根据所述第i个第一量化系数和所述第i个第二量化系数的第一特性,确定所述第i个第二量化系数。
第二方面,本申请实施例提供一种视频编码方法,包括:
确定当前块的N个第二量化系数,所述N为正整数;
针对所述N个第二量化系数中的第i个第二量化系数,对所述第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数,所述i为小于或等于N的正整数;
对所述第i个第一量化系数进行编码,得到码流,所述第i个第二量化系数的第一特性通过所述第i个第二量化系数在所述当前块中对应的区域的第二特性进行标识。
第三方面,本申请提供了一种视频编码器,用于执行上述第一方面或其各实现方式中的方法。具体地,该编码器包括用于执行上述第一方面或其各实现方式中的方法的功能单元。
第四方面,本申请提供了一种视频解码器,用于执行上述第二方面或其各实现方式中的方法。具体地,该解码器包括用于执行上述第二方面或其各实现方式中的方法的功能单元。
第五方面,提供了一种视频编码器,包括处理器和存储器。该存储器用于存储计算机程序,该处理器用于调用并运行该存储器中存储的计算机程序,以执行上述第一方面或其各实现方式中的方法。
第六方面,提供了一种视频解码器,包括处理器和存储器。该存储器用于存储计算机程序,该处理器用于调用并运行该存储器中存储的计算机程序,以执行上述第二方面或其各实现方式中的方法。
第七方面,提供了一种视频编解码系统,包括视频编码器和视频解码器。视频编码器用于执行上述第一方面或其各实现方式中的方法,视频解码器用于执行上述第二方面或其各实现方式中的方法。
第八方面,提供了一种芯片,用于实现上述第一方面至第二方面中的任一方面或其各实现方式中的方法。具体地,该芯片包括:处理器,用于从存储器中调用并运行计算机程序,使得安装有该芯片的设备执行如上述第一方面至第二方面中的任一方面或其各实现方式中的方法。
第九方面,提供了一种计算机可读存储介质,用于存储计算机程序,该计算机程序使得计算机执行上述第一方面至第二方面中的任一方面或其各实现方式中的方法。
第十方面,提供了一种计算机程序产品,包括计算机程序指令,该计算机程序指令使得计算机执行上述第一方面至第二方面中的任一方面或其各实现方式中的方法。
第十一方面,提供了一种计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面至第二方面中的任一方面或其各实现方式中的方法。
第十二方面,提供了一种码流,包括第二方面任一方面生成的码流。
基于以上技术方案,解码码流,确定当前块中的N个第一量化系数,N个第一量化系数中的第i个第一量化系数为对当前块中的第i个第二量化系数的第一特性进行隐藏后得到的量化系数,接着,确定第i个第一量化系数在当前块中对应的区域;根据第i个第一量化系数在当前块中对应的区域的第二特性,确定第i个第二量化系数的第一特性;根据第i个第一量化系数和第i个第二量化系数的第一特性,确定第i个第二量化系数。即本申请实施例,对当前块中的N个第二量化系数的第一特性进行隐藏,得到N个第一量化系数,在编码时对N个第一量化系数进行编码,可以减少编码所需的比特数,降低视频压缩代价。
附图说明
图1为本申请实施例涉及的一种视频编解码系统的示意性框图;
图2是本申请实施例提供的视频编码器的示意性框图;
图3是本申请实施例提供的解码框架的示意性框图;
图4A为本申请实施例涉及的一种扫描方法示意图;
图4B为本申请实施例涉及的另一种扫描方法示意图;
图5为本申请实施例提供的一种视频解码码方法的流程示意图;
图6为本申请一实施例中N个第一量化系数的分布示意图;
图7为本申请一实施例中N个第一量化系数的分布以及对应区域的示意图;
图8为本申请另一实施例中N个第一量化系数的分布以及对应区域的示意图;
图9为本申请一实施例提供的视频解码方法流程示意图;
图10为本申请实施例提供的视频编码方法的一种流程示意图;
图11为本申请一实施例提供的视频编码方法流程示意图;
图12是本申请实施例提供的视频解码装置的示意性框图;
图13是本申请实施例提供的视频编码装置的示意性框图;
图14是本申请实施例提供的电子设备的示意性框图;
图15是本申请实施例提供的视频编解码系统的示意性框图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。
本申请可应用于图像编解码领域、视频编解码领域、硬件视频编解码领域、专用电路视频编解码领域、实时视频编解码领域等。或者,本申请的方案可结合至其它专属或行业标准而操作,所述标准包含ITU-TH.261、ISO/IECMPEG-1Visual、ITU-TH.262或ISO/IECMPEG-2Visual、ITU-TH.263、ISO/IECMPEG-4Visual,ITU-TH.264(还称为ISO/IECMPEG-4AVC),包含可分级视频编解码(SVC)及多视图视频编解码(MVC)扩展。应理解,本申请的技术不限于任何特定编解码标准或技术。
为了便于理解,首先结合图1对本申请实施例涉及的视频编解码系统进行介绍。
图1为本申请实施例涉及的一种视频编解码系统的示意性框图。需要说明的是,图1只是一种示例,本申请实施例的视频编解码系统包括但不限于图1所示。如图1所示,该视频编解码系统100包含编码设备110和解码设备120。其中编码设备用于对视频数据进行编码(可以理解成压缩)产生码流,并将码流传输给解码设备。解码设备对编码设备编码产生的码流进行解码,得到解码后的视频数据。
本申请实施例的编码设备110可以理解为具有视频编码功能的设备,解码设备120可以理解为具有视频解码功能的设备,即本申请实施例对编码设备110和解码设备120包括更广泛的装置,例如包含智能手机、台式计算机、移动计算装置、笔记本(例如,膝上型)计算机、平板计算机、机顶盒、电视、相机、显示装置、数字媒体播放器、视频游戏控制台、车载计算机等。
在一些实施例中,编码设备110可以经由信道130将编码后的视频数据(如码流)传输给解码设备120。信道130可以包括能够将编码后的视频数据从编码设备110传输到解码设备120的一个或多个媒体和/或装置。
在一个实例中,信道130包括使编码设备110能够实时地将编码后的视频数据直接发射到解码设备120的一个或多个通信媒体。在此实例中,编码设备110可根据通信标准来调制编码后的视频数据,且将调制后的视频数据发射到解码设备120。其中通信媒体包含无线通信媒体,例如射频频谱,可选的,通信媒体还可以包含有线通信媒体,例如一根或多根物理传输线。
在另一实例中,信道130包括存储介质,该存储介质可以存储编码设备110编码后的视频数据。存储介质包含多种本地存取式数据存储介质,例如光盘、DVD、快闪存储器等。在该实例中,解码设备120可从该存储介质中获取编码后的视频数据。
在另一实例中,信道130可包含存储服务器,该存储服务器可以存储编码设备110编码后的视频数据。在此实例中,解码设备120可以从该存储服务器中下载存储的编码后的视频数据。可选的,该存储服务器可以存储编码后的视频数据且可以将该编码后的视频数据发射到解码设备120,例如web服务器(例如,用于网站)、文件传送协议(FTP)服务器等。
一些实施例中,编码设备110包含视频编码器112及输出接口113。其中,输出接口113可以包含调制器/解调器(调制解调器)和/或发射器。
在一些实施例中,编码设备110除了包括视频编码器112和输入接口113外,还可以包括视频源111。
视频源111可包含视频采集装置(例如,视频相机)、视频存档、视频输入接口、计算机图形系统中的至少一个,其中,视频输入接口用于从视频内容提供者处接收视频数据,计算机图形系统用于产生视频数据。
视频编码器112对来自视频源111的视频数据进行编码,产生码流。视频数据可包括一个或多个图像(picture)或图像序列(sequence of pictures)。码流以比特流的形式包含了图像或图像序列的编码信息。编码信息可以包含编码图像数据及相关联数据。相关联数据可包含序列参数集(sequence parameter set,简称SPS)、图像参数集(picture parameter set,简称PPS)及其它语法结构。SPS可含有应用于一个或多个序列的参数。PPS可含有应用于一个或多个图像的参数。语法结构是指码流中以指定次序排列的零个或多个语法元素的集合。
视频编码器112经由输出接口113将编码后的视频数据直接传输到解码设备120。编码后的视频数据还可存储于存储介质或存储服务器上,以供解码设备120后续读取。
在一些实施例中,解码设备120包含输入接口121和视频解码器122。
在一些实施例中,解码设备120除包括输入接口121和视频解码器122外,还可以包括显示装置123。
其中,输入接口121包含接收器及/或调制解调器。输入接口121可通过信道130接收编码后的视频数据。
视频解码器122用于对编码后的视频数据进行解码,得到解码后的视频数据,并将解码后的视频数据传输至显示 装置123。
显示装置123显示解码后的视频数据。显示装置123可与解码设备120整合或在解码设备120外部。显示装置123可包括多种显示装置,例如液晶显示器(LCD)、等离子体显示器、有机发光二极管(OLED)显示器或其它类型的显示装置。
此外,图1仅为示例,本申请实施例的技术方案不限于图1,例如本申请的技术还可以应用于单侧的视频编码或单侧的视频解码。
下面对本申请实施例涉及的视频编码器进行介绍。
图2是本申请实施例提供的视频编码器的示意性框图。应理解,该视频编码器200可用于对图像进行有损压缩(lossy compression),也可用于对图像进行无损压缩(lossless compression)。该无损压缩可以是视觉无损压缩(visually lossless compression),也可以是数学无损压缩(mathematically lossless compression)。
该视频编码器200可应用于亮度色度(YCbCr,YUV)格式的图像数据上。例如,YUV比例可以为4:2:0、4:2:2或者4:4:4,Y表示明亮度(Luma),Cb(U)表示蓝色色度,Cr(V)表示红色色度,U和V表示为色度(Chroma)用于描述色彩及饱和度。例如,在颜色格式上,4:2:0表示每4个像素有4个亮度分量,2个色度分量(YYYYCbCr),4:2:2表示每4个像素有4个亮度分量,4个色度分量(YYYYCbCrCbCr),4:4:4表示全像素显示(YYYYCbCrCbCrCbCrCbCr)。
例如,该视频编码器200读取视频数据,针对视频数据中的每帧图像,将一帧图像划分成若干个编码树单元(coding tree unit,CTU),在一些例子中,CTB可被称作“树型块”、“最大编码单元”(Largest Coding unit,简称LCU)或“编码树型块”(coding tree block,简称CTB)。每一个CTU可以与图像内的具有相等大小的像素块相关联。每一像素可对应一个亮度(luminance或luma)采样及两个色度(chrominance或chroma)采样。因此,每一个CTU可与一个亮度采样块及两个色度采样块相关联。一个CTU大小例如为128×128、64×64、32×32等。一个CTU又可以继续被划分成若干个编码单元(Coding Unit,CU)进行编码,CU可以为矩形块也可以为方形块。CU可以进一步划分为预测单元(prediction Unit,简称PU)和变换单元(transform unit,简称TU),进而使得编码、预测、变换分离,处理的时候更灵活。在一种示例中,CTU以四叉树方式划分为CU,CU以四叉树方式划分为TU、PU。
视频编码器及视频解码器可支持各种PU大小。假定特定CU的大小为2N×2N,视频编码器及视频解码器可支持2N×2N或N×N的PU大小以用于帧内预测,且支持2N×2N、2N×N、N×2N、N×N或类似大小的对称PU以用于帧间预测。视频编码器及视频解码器还可支持2N×nU、2N×nD、nL×2N及nR×2N的不对称PU以用于帧间预测。
在一些实施例中,如图2所示,该视频编码器200可包括:预测单元210、残差单元220、变换/量化单元230、反变换/量化单元240、重建单元250、环路滤波单元260、解码图像缓存270和熵编码单元280。需要说明的是,视频编码器200可包含更多、更少或不同的功能组件。
可选的,在本申请中,当前块可以称为当前编码单元(CU)或当前预测单元(PU)等。预测块也可称为预测图像块或图像预测块,重建图像块也可称为重建块或图像重建图像块。
在一些实施例中,预测单元210包括帧间预测单元211和帧内预测单元212。由于视频的一个帧中的相邻像素之间存在很强的相关性,在视频编解码技术中使用帧内预测的方法消除相邻像素之间的空间冗余。由于视频中的相邻帧之间存在着很强的相似性,在视频编解码技术中使用帧间预测方法消除相邻帧之间的时间冗余,从而提高编码效率。
帧间预测单元211可用于帧间预测,帧间预测可以参考不同帧的图像信息,帧间预测使用运动信息从参考帧中找到参考块,根据参考块生成预测块,用于消除时间冗余;帧间预测所使用的帧可以为P帧和/或B帧,P帧指的是向前预测帧,B帧指的是双向预测帧。运动信息包括参考帧所在的参考帧列表,参考帧索引,以及运动矢量。运动矢量可以是整像素的或者是分像素的,如果运动矢量是分像素的,那么需要再参考帧中使用插值滤波做出所需的分像素的块,这里把根据运动矢量找到的参考帧中的整像素或者分像素的块叫参考块。有的技术会直接把参考块作为预测块,有的技术会在参考块的基础上再处理生成预测块。在参考块的基础上再处理生成预测块也可以理解为把参考块作为预测块然后再在预测块的基础上处理生成新的预测块。
帧内预测单元212只参考同一帧图像的信息,预测当前码图像块内的像素信息,用于消除空间冗余。帧内预测所使用的帧可以为I帧。例如图50所示,白色的4×4块是当前块,当前块左边一行和上面一列的灰色的像素为当前块的参考像素,帧内预测使用这些参考像素对当前块进行预测。这些参考像素可能已经全部可得,即全部已经编解码。也可能有部分不可得,比如当前块是整帧的最左侧,那么当前块的左边的参考像素不可得。或者编解码当前块时,当前块左下方的部分还没有编解码,那么左下方的参考像素也不可得。对于参考像素不可得的情况,可以使用可得的参考像素或某些值或某些方法进行填充,或者不进行填充。
在一些实施例中,帧内预测方法还包括多参考行帧内预测方法(multiple reference line,MRL),MRL可以使用更多的参考像素从而提高编码效率。
帧内预测有多种预测模式,例如H.264中对4×4的块进行帧内预测的9种模式。其中模式0是将当前块上面的像素按竖直方向复制到当前块作为预测值;模式1是将左边的参考像素按水平方向复制到当前块作为预测值;模式2(DC)是将A~D和I~L这8个点的平均值作为所有点的预测值,模式3至模式8是分别按某一个角度将参考像素复制到当前块的对应位置。因为当前块某些位置不能正好对应到参考像素,可能需要使用参考像素的加权平均值,或者说是插值的参考像素的分像素。
HEVC使用的帧内预测模式有平面模式(Planar)、DC和33种角度模式,共35种预测模式。VVC使用的帧内模式有Planar、DC和65种角度模式,共67种预测模式。AVS3使用的帧内模式有DC、Plane、Bilinear和63种角度模式,共66种预测模式。
需要说明的是,随着角度模式的增加,帧内预测将会更加精确,也更加符合对高清以及超高清数字视频发展的需求。
残差单元220可基于CU的像素块及CU的PU的预测块来产生CU的残差块。举例来说,残差单元220可产生CU的残差块,使得残差块中的每一采样具有等于以下两者之间的差的值:CU的像素块中的采样,及CU的PU的预测块中的对应采样。
变换/量化单元230可量化变换系数。变换/量化单元230可基于与CU相关联的量化参数(QP)值来量化与CU的TU相关联的变换系数。视频编码器200可通过调整与CU相关联的QP值来调整应用于与CU相关联的变换系数的量化程度。
反变换/量化单元240可分别将逆量化及逆变换应用于量化后的变换系数,以从量化后的变换系数重建残差块。
重建单元250可将重建后的残差块的采样加到预测单元210产生的一个或多个预测块的对应采样,以产生与TU相关联的重建图像块。通过此方式重建CU的每一个TU的采样块,视频编码器200可重建CU的像素块。
环路滤波单元260可执行消块滤波操作以减少与CU相关联的像素块的块效应。
在一些实施例中,环路滤波单元260包括去块滤波单元、样点自适应补偿SAO单元、自适应环路滤波ALF单元。
解码图像缓存270可存储重建后的像素块。帧间预测单元211可使用含有重建后的像素块的参考图像来对其它图像的PU执行帧间预测。另外,帧内预测单元212可使用解码图像缓存270中的重建后的像素块来对在与CU相同的图像中的其它PU执行帧内预测。
熵编码单元280可接收来自变换/量化单元230的量化后的变换系数。熵编码单元280可对量化后的变换系数执行一个或多个熵编码操作以产生熵编码后的数据。
本申请涉及的视频编码的基本流程如下:在编码端,将当前图像划分成块,针对当前块,预测单元210使用帧内预测或帧间预测产生当前块的预测块。残差单元220可基于预测块与当前块的原始块计算残差块,即预测块和当前块的原始块的差值,该残差块也可称为残差信息。该残差块经由变换/量化单元230变换与量化等过程,可以去除人眼不敏感的信息,以消除视觉冗余。可选的,经过变换/量化单元230变换与量化之前的残差块可称为时域残差块,经过变换/量化单元230变换与量化之后的时域残差块可称为频率残差块或频域残差块。熵编码单元280接收到变换量化单元230输出的量化后的变换系数,可对该量化后的变换系数进行熵编码,输出码流。例如,熵编码单元280可根据目标上下文模型以及二进制码流的概率信息消除字符冗余。
另外,视频编码器对变换量化单元230输出的量化后的变换系数进行反量化和反变换,得到当前块的残差块,再将当前块的残差块与当前块的预测块进行相加,得到当前块的重建块。随着编码的进行,可以得到当前图像中其他图像块对应的重建块,这些重建块进行拼接,得到当前图像的重建图像。由于编码过程中引入误差,为了降低误差,对重建图像进行滤波,例如,使用ALF对重建图像进行滤波,以减小重建图像中像素点的像素值与当前图像中像素点的原始像素值之间差异。将滤波后的重建图像存放在解码图像缓存270中,可以为后续的帧作为帧间预测的参考帧。
需要说明的是,编码端确定的块划分信息,以及预测、变换、量化、熵编码、环路滤波等模式信息或者参数信息等在必要时携带在码流中。解码端通过解析码流及根据已有信息进行分析确定与编码端相同的块划分信息,预测、变换、量化、熵编码、环路滤波等模式信息或者参数信息,从而保证编码端获得的解码图像和解码端获得的解码图像相同。
图3是本申请实施例提供的视频解码器的示意性框图。
如图3所示,视频解码器300包含:熵解码单元310、预测单元320、反量化/变换单元330、重建单元340、环路滤波单元350及解码图像缓存360。需要说明的是,视频解码器300可包含更多、更少或不同的功能组件。
视频解码器300可接收码流。熵解码单元310可解析码流以从码流提取语法元素。作为解析码流的一部分,熵解码单元310可解析码流中的经熵编码后的语法元素。预测单元320、反量化/变换单元330、重建单元340及环路滤波单元350可根据从码流中提取的语法元素来解码视频数据,即产生解码后的视频数据。
在一些实施例中,预测单元320包括帧间预测单元321和帧内预测单元322。
帧间预测单元321可执行帧内预测以产生PU的预测块。帧间预测单元321可使用帧内预测模式以基于空间相邻PU的像素块来产生PU的预测块。帧间预测单元321还可根据从码流解析的一个或多个语法元素来确定PU的帧内预测模式。
帧内预测单元322可根据从码流解析的语法元素来构造第一参考图像列表(列表0)及第二参考图像列表(列表1)。此外,如果PU使用帧间预测编码,则熵解码单元310可解析PU的运动信息。帧内预测单元322可根据PU的运动信息来确定PU的一个或多个参考块。帧内预测单元322可根据PU的一个或多个参考块来产生PU的预测块。
反量化/变换单元330可逆量化(即,解量化)与TU相关联的变换系数。反量化/变换单元330可使用与TU的CU相关联的QP值来确定量化程度。
在逆量化变换系数之后,反量化/变换单元330可将一个或多个逆变换应用于逆量化变换系数,以便产生与TU相关联的残差块。
重建单元340使用与CU的TU相关联的残差块及CU的PU的预测块以重建CU的像素块。例如,重建单元340可将残差块的采样加到预测块的对应采样以重建CU的像素块,得到重建图像块。
环路滤波单元350可执行消块滤波操作以减少与CU相关联的像素块的块效应。
在一些实施例中,环路滤波单元350包括去块滤波单元、样点自适应补偿SAO单元、自适应环路滤波ALF单元。
视频解码器300可将CU的重建图像存储于解码图像缓存360中。视频解码器300可将解码图像缓存360中的重建图像作为参考图像用于后续预测,或者,将重建图像传输给显示装置呈现。
本申请涉及的视频解码的基本流程如下:熵解码单元310可解析码流得到当前块的预测信息、量化系数矩阵等,预测单元320基于预测信息对当前块使用帧内预测或帧间预测产生当前块的预测块。反量化/变换单元330使用从码流得到的量化系数矩阵,对量化系数矩阵进行反量化、反变换得到残差块。重建单元340将预测块和残差块相加得到重 建块。重建块组成重建图像,环路滤波单元350基于图像或基于块对重建图像进行环路滤波,得到解码图像。该解码图像也可以称为重建图像,该重建图像一方面可以被显示设备进行显示,另一方面可以存放在解码图像缓存360中,为后续的帧作为帧间预测的参考帧。
上述是基于块的混合编码框架下的视频编解码器的基本流程,随着技术的发展,该框架或流程的一些模块或步骤可能会被优化,本申请适用于该基于块的混合编码框架下的视频编解码器的基本流程,但不限于该框架及流程。
下面对本申请涉及的量化相关技术进行介绍。
量化、反量化与系数编码部分关系紧密,量化的目的是将变换系数缩放,从而使得编码系数时消耗的比特数减少。
在一些实施例中,存在跳过变换的情况,此时量化的对象为残差,即直接对残差进行缩放后,进行编码。
示例性的,可以采用如下公式(1)实现量化:
Figure PCTCN2022097683-appb-000001
其中,t i为变换系数,qstep为量化步长,与配置文件中设置的量化参数相关,q i为量化系数,round为取整过程,不限于上取整或下取整等,量化的过程受编码器控制。
示例性的,可以采用如下公式(2)实现反量化:
t′ i=q i·qstep      (2)
其中,t′ i为重建的变换系数,由于取整过程中造成的精度损失,t′ i与t i是不同的。
量化会使得变换系数的精度降低,并且精度的损失是不可逆的。编码器通常通过率失真代价函数来衡量量化的代价。
示例性的,采用如下公式(3)确定量化代价:
J=D+λ·R=(t i-t′ i) 2+λ·B(q i)    (3)
其中,J为量化代价,D为失真,R为码率,λ为量化参数QP的函数,B()为编码器估计编码量化系数q i所消耗的比特。
理论上,无论编码器如何决定q i的取值,解码端的反量化过程都是不变的,所以编码器可以更自由的决定q i。通常的,编码器会根据当前块总的代价最小为原则,对每一个q i进行调整以达到整体代价最优化,这样的过程叫做率失真优化量化,也被广泛使用在视频编码中。
在一些实施例中,可以使用多符号的算数编码(Multi-symbol arithmetic coding)方式对量化系数进行编码或解码,每个量化系数都可以由一个或多个多符号的标识来指示,具体的,根据量化系数的大小,可分段由以下几种多符号的标识位表示。
标识1:表示0~3的部分,共4个符号(0,1,2,3),当标识1的符号为3时,则需要进一步编码/解码标识2。
标识2:表示3~6的部分,共4个符号(0,1,2,3),当标识2的符号为3时,则需要进一步编码/解码标识3。
标识3:表示6~9的部分,共4个符号(0,1,2,3),当标识3的符号为3时,则需要进一步编码/解码标识4。
标识4:表示9~12的部分,共4个符号(0,1,2,3),当标识4的符号为3时,则需要进一步编码/解码标识5。
标识5:表示12~15的部分,共4个符号(0,1,2,3),当标识5的符号为3时,则需要进一步编码/解码大于等于15的部分。
大于等于15的部分使用指数哥伦布编码/解码且不依赖上下文模型,而标识1~5则使用上下文模型,其中标识1有一套单独的上下文模型,而标识2-5公用一套上下文模型。另外若当前系数为非零系数时,还需要编码/解码正负号。各个标识在变换块中的编码/解码过程如下:
首先,按照从最后一个非零系数至变换块左上角的扫描顺序,编码/解码标识1-5。
接着,分别按照从变换块左上角到最后一个非零系数的顺序,编码/解码非零系数的正负号和超过系数超过15的部分,其中,左上角系数若为非零,其正负号的编码/解码采用上下文模型编码,其余位置上的非零系数编码/解码采用等概率模型编码。
示例性的,编码语法如下表1所示:
表1
Figure PCTCN2022097683-appb-000002
Figure PCTCN2022097683-appb-000003
上述表1中S()为多符号的上下文模型编码,L(1)为旁路编码。
在一些实施例中,系数编码和解码时,通常采用如图4A所示的Diagonal scan(对角线扫描),或者采用如图4B所示的Zig-Zag scan(之字形扫描)。在一些实施例中,系数编码和解码时还可以采用Column scan(列扫描)和Row scan(行扫描)等扫描方式,本申请实施例对变换块的具体扫描方式不做限制。如图4A和图4B所示,以16个系数为一组,可将每个变换块划分为多个区域,以一个区域为扫描单位进行扫描,在一个区域扫描结束后,扫描其他区域。由于变换可以将能量集中在变换块的左上角,实际的系数解码顺序定义为逆扫描顺序,即从变换块的右下角的第一个非零系数开始,按解码顺序进行顺序解码。例如图4A和图4B所示,从变换块的右下角的第一个非零系数开始,按照解码顺序向变换块的左上角位置进行解码。
目前量化系数的编码方式通常是,对量化系数进行完全编码,例如对量化系数的绝对值进行完全编码,其占用比特位较多,编码代价大。
本申请实施例,在量化系数的编码过程中,对当前块中的第二量化系数的第一特性进行隐藏,得到第一量化系数,并对第一量化系数进行编码,以减少编码所需的比特数,进而降低编码代价。
下面结合具体的实施例对本申请实施例提供的技术方案进行详细描述。
首先结合图5,以解码端为例进行介绍。
图5为本申请实施例提供的一种视频解码码方法的流程示意图,本申请实施例应用于图1和图3所示视频解码器。如图5所示,本申请实施例的方法包括:
S501、解码码流,确定当前块的N个第一量化系数。
其中,N个第一量化系数中的第i个第一量化系数为对当前块中的第i个第二量化系数的第一特性进行隐藏后得到的量化系数,N为正整数,i为小于或等于N的正整数。
为了便于描述,本申请实施例将奇偶性被隐藏的量化系数,称为第一量化系数。
在一些实施例中,奇偶性被隐藏的第一量化系数也称为隐藏系数。
在一些实施例中,当前块也可以称为当前变换块或当前解码块等。
本申请实施例中,为了降低编码代价,编码端对当前块中的N个第二量化系数的第一特性进行隐藏,得到N个第一量化系数,例如,编码端对第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数。这样,在编码时,编码端对N个第一量化系数进行编码,而不是对N个第二量化系数进行编码。由于N个第一量化系数是对N个第二量化系数的第一特性进行隐藏得到的,因此,N个第一量化系数的编码值小于N个第二量化系数,这样对编码值较小的N个第一量化系数进行编码时,可以使用更少的比特数,进而降低了编码代价。
本申请实施例对第一特征不做限制,可以是第二量化系数任意需要编码的特性。
在一种示例中,第一特性为正负号,此时,第一量化系数为对对应位置上的第二量化系数的正负号进行隐藏后,得到的量化系数。
在另一种示例中,第一特性为奇偶性,此时,第一量化系数为根据对应位置上的第二量化系数的奇偶性,对第二量化系数的部分绝对值进行隐藏后,得到的量化系数。
在一些实施例中,上述量化系数是对变换系数进行量化得到的。例如,编码端对当前块进行预测,得到当前块的预测值,当前块的原始值与预测值进行相减,得到当前块的残差值。编码端对残差值进行变换,得到当前块的变换系数,接着,对变换系数进行量化,得到量化系数,再对量化系数进行编码,得到码流。这样,解码端接收到码流中,解码码流,得到量化系数,对量化系数进行反量化,得到当前块的变换系数,再对变换系数进行反变换,得到当前块的残差值。可选的,在该实例中,上述当前块也可以称为当前变换块。
在一些实施例中,上述量化系数是对残差值进行量化得到的。例如,编码端对当前块进行预测,得到当前块的预测值,当前块的原始值与预测值进行相减,得到当前块的残差值。编码端对残差值进行量化,得到量化系数,再对量化系数进行编码,得到码流。这样,解码端接收到码流中,解码码流,得到量化系数,对量化系数进行反量化,得到当前块的残差值。
在一些实施例中,量化系数可以理解为从码流中解码出的绝对值以及正负号组成的数值。
在一些实施例中,上述量化系数的绝对值包括小于或等于15的部分的值,例如对标识1到标识5进行解码,得到绝对值小于或等于15部分的值。
在一些实施例中,若该量化系数的值超过15,则量化系数的绝对值还包括超过15部分的值。
本申请实施例对当前块中N个第一量化系数的具体位置不做限制。例如图6所示,N个第一量化系数为索引为48、32、16和0四个位置上的系数。
在一些实施例中,变换使得当前块的能量主要集中在左上角区域内,也就是说,当前块的非零量化系数主要集中在当前块的左上角区域,当前块的右下角区域中的量化系数通常为0。基于此,为了有效的降低编码代价,则本申请实施例的N个第一量化参数位于当前块的左上角区域内。例如,N个第一量化系数为位置索引为0、1、2、4等上的量化系数。
上述S501中,解码码流,确定当前块的N个第一量化系数的方法包括但不限于如下几种:
方式一,当前块中N个第一量化系数的位置为预设的,或默认的。这样,解码端对码流进行解码,可以得到N个第一量化系数。
方式二,通过如下S501-A和S501-B确定当前块的N个第一量化系数:
S501-A、解码码流,得到当前块的量化系数的个数。
S501-B、根据当前块的量化系数的个数,确定N个第一量化系数。
本申请实施例所述的当前块的量化系数的个数是指当前块中第一个解码的非零系数至最后一个解码系数之间的所有系数个数。例如图5中,对于一个8×8的当前块,当前块中位置索引21处的量化系数为扫描顺序(即解码顺序或 解码扫描顺序)中的第一个非零量化系数,解码时,解码端从位置索引21处的量化系数开始,沿着扫描顺序向当前块左上角的位置索引0处的量化系数进行解码,待解码的量化系数合计22,也就是说,当前块中量化系数的个数为22个。
在本申请实施例中,若当前块所包括的量化系数较少时,则编码代价较小,此时,编码端可以直接对数量较少的量化系数进行直接编码,而无需进行隐藏。若当前块所包括的量化系数较多时,编码端的编码代价较大,此时,为了降低编码代价,则可以对当前块中的部分量化系数的第一特性进行隐藏,以降低编码代价。由此可知,当前块所包括的量化系数的个数,会影响编码代价,因此,在该方式二中,通过当前块所包括的量化系数的个数,确定当前块中的N个第一量化系数,进一步降低编码代价。
本申请实施例对上述S501-A中解码码流,得到当前块的量化系数的个数的方法不做限制。
在一种可能的实现方式中,编码端将当前块中量化系数的个数写入码流,这样解码端通过解码码流,可以得到当前块的量化系数的个数。
在另一种可能的实现方式中,解码端通过解码码流,得到当前块的所有量化系数,进而从中获得当前块的量化系数。
解码端确定出当前块的量化系数的个数后,根据当前块的量化系数的个数,确定当前块的N个第一量化系数。
例如,若当前块的量化系数的个数小于预设值1时,则将当前块中位于左上角的一个量化系数,确定为第一量化系数。
再例如,若当前块的量化系数的个数小于预设值2时,则将当前块中位于左上角的两个相邻的量化系数,分别确定为第一量化系数,得到2个第一量化系数。在一种示例中,两个相邻的量化系数可以是空间位置上相邻的量化系数。在另一种示例中,两个相邻的量化系数为扫描顺序上相邻的两个量化系数。
在一些实施例中,可以通过如下S501-B1至S501-B3的步骤,确定出N个第一量化系数:
S501-B1、确定第一阈值;
S501-B2、根据当前块的量化系数的个数和第一阈值,确定当前块中的第一量化系数的个数;
S501-B3、根据当前块中的第一量化系数的个数,将当前块的左上角区域中的N个量化系数,确定为N个第一量化系数。
在该实施例中,解码端可以根据当前块的量化系数的个数,来计算当前块中的第一量化系数的个数,进而根据第一量化系数的个数N,确定当前块的N个第一量化系数。
具体的,解码端确定第一阈值,接着,根据该第一阈值与上述确定的当前块的量化系数的个数,确定当前块中第一量化系数的个数N,进而将当前块的左上角区域中的N个量化系数,确定为N个第一量化系数。
本申请实施例对上述S501-B1中确定第一阈值的方法不做限制。
例如,上述第一阈值为预设值或为默认值,这样解码端可以将该预设值或默认值确定为第一阈值。
再例如,上述第一阈值编码端写入码流,这样解码端可以通过解码码流,得到该第一阈值。
本申请实施例对该第一阈值的具体取值不做限制,例如可以为16、8、4等。
解码端确定出第一阈值后,执行S501-B2,根据当前块的量化系数的个数和第一阈值,确定当前块中的第一量化系数的个数。本申请实施例对上述S501-B2的具体实现方式不做限制。
在一种示例中,将当前块的量化系数的个数和第一阈值的比值的整数部分,确定为当前块中的第一量化系数的个数。
在另一种示例中,将当前块的量化系数的个数和第一阈值的比值的四舍五入值,确定为当前块中的第一量化系数的个数。
在又一种示例中,将当前块的量化系数的个数和第一阈值的比值向上取值后的值,确定为当前块中的第一量化系数的个数。
例如,根据如下公式(4),确定当前块中的第一量化系数的个数:
Figure PCTCN2022097683-appb-000004
其中,N为当前块中第一量化系数的个数,M可为第一阈值,N coeff为当前块的量化系数的个数,
Figure PCTCN2022097683-appb-000005
表示向上取整。例如,N coeff为22,M为16,则根据上述公式(4)计算得到N为2。
根据上述方法,确定出当前块中第一量化系数的个数N后,执行上述S501-B3,以根据当前块中的第一量化系数的个数,将当前块的左上角区域中的N个量化系数,确定为N个第一量化系数。
本申请实施例对上述S501-B3的具体实现方式不做限制。
在一种可能的实现方式中,将当前块的左上角区域中的任意N个量化系数,确定为N个第一量化系数。例如,这N个第一量化系数为当前块左上角区域中,空间位置上相邻或部分相邻或均不相邻的N个量化系数。
在另一种可能的实现方式中,根据扫描顺序,将当前块的左上角区域中的N个量化系数,确定为N个第一量化系数。
例如,将当前块的左上角区域中,在扫描顺序上相邻的N个量化系数,确定为N个第一量化系数。
再例如,将当前块中位于扫描顺序的后N个量化系数,确定为N个第一量化系数。假设N=2,则将图6中,索引0和索引1对应的2个量化系数,确定为2个第一量化系数。
在一些实施例中,若解码时,解码端先对标识1至标识5进行解码,即先对小于或等于15部分的绝对值进行解码,再对绝对值大于15的部分进行解码。基于此,本申请实施例中,为了提高解码效果,则上述第一量化系数可以理解为部分量化系数,例如小于16部分的量化系数,即对标识1至标识5进行解码,得到的量化系数。
也就是说,解码端在确定出当前块的所有量化系数小于16部分的值之后,确定当前块的N个第一量化系数。示 例性的,解码码流,得到当前块的已解码信息,从当前块的已解码信息中,确定出当前块的N个第一量化系数。
可选的,上述当前块的已解码信息中包括当前块中小于16部分的量化系数,进而根据当前块中第一量化系数的个数和位置,从当前块的已解码信息中,确定出当前块的N个第一量化系数。
在一些实施例中,可以通过至少一个标志来指示当前块是否允许采用本申请实施例提供的量化系数第一特性被隐藏的技术。在一些实施例中,本申请实施例提供的量化系数的第一特性被隐藏的技术也称为第一特性隐藏技术。
示例性的,设置的至少一个标志可以是不同级别的标志,用于指示对应级别是否允许量化系数的第一特性被隐藏。
可选的,上述至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志中的至少一个。
例如,上述至少一个标志包括序列级标志,该序列级标志用于指示当前序列是否允许量化系数的第一特性被隐藏。例如,若该序列级标志的取值为1时,指示当前序列允许量化系数的第一特性被隐藏,若该序列级标志的取值为0时,指示当前序列不允许量化系数的第一特性被隐藏。
可选的,若至少一个标志包括序列级标志时,该序列级标志可以位于序列头(sequence header)中。
再例如,上述至少一个标志包括图像级标志,该图像级标志用于指示当前图像是否允许量化系数的第一特性被隐藏。例如,若该图像级标志的取值为1时,指示当前图像允许量化系数的第一特性被隐藏,若该图像级标志的取值为0时,指示当前图像不允许量化系数的第一特性被隐藏。
可选的,若至少一个标志包括图像级标志时,该图像级标志可以位于图像头(picture header)中。
再例如,上述至少一个标志包括片级标志,该片级标志用于指示当前片(slice)是否允许量化系数的第一特性被隐藏。例如,若该片级标志的取值为1时,指示当前片允许量化系数的第一特性被隐藏,若该片级标志的取值为0时,指示当前片不允许量化系数的第一特性被隐藏。
可选的,若至少一个标志包括片级标志时,该片级标志可以位于片头(slice header)中。
再例如,上述至少一个标志包括单元级标志,该单元级标志用于指示当前CTU是否允许量化系数的第一特性被隐藏。例如,若该单元级标志的取值为1时,指示当前CTU允许量化系数的第一特性被隐藏,若该单元级标志的取值为0时,指示当前CTU不允许量化系数的第一特性被隐藏。
再例如,上述至少一个标志包括块级标志,该块级标志用于指示当前块是否允许量化系数的第一特性被隐藏。例如,若该块级标志的取值为1时,指示当前块允许量化系数的第一特性被隐藏,若该块级标志的取值为0时,指示当前块不允许量化系数的第一特性被隐藏。
这样,解码端首先解码码流,得到上述至少一个标志,根据这至少一个标志,判断当前块是否允许量化系数的第一特性被隐藏。若根据上述至少一个标志,确定当前块不允许量化系数的第一特性被隐藏时,则跳过本申请实施例的方法,直接将上述解码出的量化系数进行反量化,得到变换系数。若根据上述至少一个标志,确定当前块允许使用本申请实施例提供的第一特性隐藏技术时,则执行本申请实施例的方法。
例如,若上述至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志。此时,解码端首先解码码流,得到序列级标志,若该序列级标志指示当前序列不允许使用本申请实施例提供的第一特性隐藏技术时,则跳过本申请实施例的方法,采用传统的方法,对当前块进行反量化。若该序列级标志指示当前序列允许使用本申请实施例提供的第一特性隐藏技术时,则继续解码码流,得到图像级标志,若该图像级标志指示当前图像不允许使用本申请实施例提供的第一特性隐藏技术时,则跳过本申请实施例的方法,采用传统的方法,对当前块进行反量化。若该图像级标志指示当前图像允许使用本申请实施例提供的第一特性隐藏技术时,则继续解码码流,得到片级标志,若该片级标志指示当前片不允许使用本申请实施例提供的第一特性隐藏技术时,则跳过本申请实施例的方法,采用传统的方法,对当前块进行反量化。若该片级标志指示当前片允许使用本申请实施例提供的第一特性隐藏技术时,则继续解码码流,得到单元级标志,若该单元级标志指示当前CTU不允许使用本申请实施例提供的第一特性隐藏技术时,则跳过本申请实施例的方法,采用传统的方法,对当前块进行反量化。若该单元级标志指示当前CTU允许使用本申请实施例提供的第一特性隐藏技术时,则继续解码码流,得到块级标志,若该块级标志指示当前块不允许使用本申请实施例提供的第一特性隐藏技术时,则跳过本申请实施例的方法,采用传统的方法,对当前块进行反量化。若该块级标志指示当前块允许使用本申请实施例提供的第一特性隐藏技术时,则执行本申请实施例。
在一些实施例中,本申请实施例提供的第一特性隐藏技术,与目标变换方式互斥,其中目标变换方式包括二次变换或多次变换等。此时,解码端在确定当前块采用目标变换方式进行变换时,则跳过本申请实施例提供的技术方案,例如,跳过上述S501的步骤。
本申请实施例中,根据上述步骤,解码码流,确定当前块的N个第一量化系数后,执行如下S502步骤。
S502、确定第i个第一量化系数在当前块中对应的区域。
在本申请实施例中,为了降低编码代价,编码端根据第二量化系数在当前块中对应的区域的某些特性,对第二量化系数的第一特性进行隐藏,得到第一量化系数。这样,解码端在对第一量化系数进行重建,得到第二量化系数时,首先确定出第i个第一量化系数对应的区域,进而根据第一量化系数对应的区域,对第一量化系数进行重建,得到第二量化系数。
也就是说,本申请实施例中,N个第一量化系数中,每一个第一量化系数在当前块中对应一个区域。其中,不同的第一量化系数在当前块中对应的区域可以相同,也可以不同,本申请实施例对此不做限制。
本申请实施例中,确定N个第一量化系数中每个第一量化系数在当前块中对应的区域的方法相同,为了便于描述,以N个第一量化系数中的第i个第一量化系数为例进行说明,其中第i个第一量化系数为N个第一量化系数中的任意一个第一量化系数。
需要说明的是,本申请实施例中,由于第i个第一量化系数和第i个第二量化系数为当前块中同一个位置处的处理后的量化系数和处理前的量化系数,因此,第i个第一量化系数在当前块中对应的区域,与第i个第二量化系数在当 前块中对应的区域为同一个区域。
本申请实施例,确定第i个第一量化系数在当前块中对应的区域的方式不做限制。
在一些实施例中,将当前块划分为N个区域,将划分得到的N个区域一一分配给N个第一量化系数,进而得到N个第一量化系数中每一个第一量化系数在当前块中对应的区域。
在该实施例的一种可能实现方式中,N个第一量化系数中每个第一量化系数在当前块中对应的区域均不包括第一量化系数,例如,第i个第一量化系数在当前块中对应的区域不包括N个第一量化系数中的任意一个第一量化系数。
在该实施例的另一种可能实现方式中,N个第一量化系数中至少一个第一量化系数对应的区域包括第一量化系数,至少一个第一量化系数对应的区域不包括第一量化系数。例如,第i个第一量化系数对应的区域包括N个第一量化系数中的任意一个或几个第一量化系数,第j个第一量化系数对应的区域不包括N个第一量化系数中的任意一个第一量化系数。其中,第j个第一量化系数为N个第一量化系数中除第i个第一量化系数之外的任意一个第一量化系数。
在一些实施例中,将当前块中除N个第一量化系数外的区域划分为N个区域,将划分得到的N个区域一一分配给N个第一量化系数,进而得到N个第一量化系数中每个第一量化系数在当前块中对应的区域。在该实施例中,N个第一量化系数中每个第一量化系数在当前块中对应的区域均不包括第一量化系数,例如,第i个第一量化系数在当前块中对应的区域不包括N个第一量化系数中任意一个第一量化系数。
下面对将当前块中除N个第一量化系数外的区域划分为N个区域的过程进行介绍。为了便于描述,在一些实施例中将当前块中除N个第一量化系数之外的区域称为其他区域。
本申请实施例中,将当前块中除N个第一量化系数外的其他区域进行划分,得到的N个区域的大小可以相同,也可以不同,本申请实施例对此不做限制。
本申请实施例中,解码端和编码端采用相同的区域划分方式,将当前块中除N个第一量化系数外的其他区域划分为N个区域。
在一些实施例中,解码端和编码端均采用默认的区域划分方式,将当前块的其他区域划分为N个区域。
在该实施例的一种可能的实现方式中,根据解码扫描顺序,将当前块的其他区域划分为N个区域。
可选的,这N个区域中至少两个区域所包括的量化系数个数相同。
可选的,这N个区域中至少两个区域所包括的量化系数个数不相同。
在一种示例中,按照解码扫描方向,将当前块的其他区域中每隔M个非零量化系数划分为一个区域,得到N个区域。这N个区域中每个区域均包括M个非零量化系数。这N个区域中至少一个区域包括一个或多个隐藏系数。在该示例中,若最后一个区域所包括的非零量化系数不为M时,则将该最后一个区域划分为单独的一个区域,或者,将该最后一个区域与上一个区域合并为一个区域。
在另一种示例中,按照解码扫描方向,将当前块的其他区域中每隔K个像素点划分为一个区域,得到N个区域。例如,对于一个使用反向ZigZag扫描顺序的8x8大小的变换块,当每个区域大小相等,即每个区域包含16个系数时,图6所示,将当前块划分为4个区域。在该示例中,划分得到的N个区域大小相同,每个区域均包括K个像素点,这N个区域中可能存在量化系数全为0的区域。在该示例中,若最后一个区域所包括的量化系数不为K时,则将该最后一个区域划分为单独的一个区域,或者,将该最后一个区域与上一个区域合并为一个区域。
在该实施例的另一种可能的实现方式中,根据空间位置,将当前块的其他区域划分为N个区域
在一种示例中,上述N个区域为当前块的子块,例如将当前块的其他区域平均划分为N个子块,示例性的,每个子块的大小为4*4。在该示例中,N个区域中可能存在量化系数全为0的区域。
在另一种示例中,根据当前块的其他区域中像素点的空间位置关系,将空间位置上相邻的多个像素点划分为一个子块。
本申请实施例中,将当前块的其他区域划分为N个区域的方法除上述各示例外,还可以包括其他的方法,本申请实施例对此不做限制。
在一些实施例中,编码端可以将当前块的区域划分方式指示给解码端。例如,在码流中编入一标志A,该标志A用于指示当前块的其他区域的区域划分方式。这样,解码端通过解码码流,得到该标志A,并根据该标志A,确定当前块的区域划分方式。
可选的,该标志A可以为序列级标志,用于指示该序列中的所有解码块均可以采用该区域划分方式,将解码块划分为N个区域。
可选的,该标志A可以为帧级标志,用于指示该图像帧中的所有解码块均可以采用该区域划分方式,将解码块划分为N个区域。
可选的,该标志A可以为片级标志,用于指示该图像片中的所有解码块均可以采用该区域划分方式,将解码块划分为N个区域。
可选的,该标志A可以为块级标志,用于指示当前块可以采用该区域划分方式,将当前块的其他区域划分为N个区域。
在该实施例中,解码端通过上述方法,将当前块中除N个第一量化系数外的其他区域划分为N个区域后,将这N个区域一一分配给N个第一量化系数,进而得到N个第一量化系数中每一个第一量化系数在当前块中对应的区域。
在一些实施例中,解码端还可以通过如下S502-A的步骤,确定第i个第一量化系数在当前块中对应的区域:
S502-A、根据当前块中的第一量化系数的个数,确定第i个第一量化系数在当前块中对应的区域。
本申请实施例中,第一量化系数在当前块中对应的区域与当前块中第一量化系数的个数有关,例如,当前块中第一量化系数的个数较多时,则可以将当前块划分为多个区域,这样每个第一量化系数在当前块中对应的区域较小。若当前块中第一量化系数的个数较少时,则可以将当前块划分为少数几个区域,这样每个第一量化系数在当前块中对应的区域较大。
上述S502-A的实现方式包括但不限于如下几种:
方式1,若N个第一量化系数中每一个第一量化系数在当前块中对应的区域均不相同,即任意两个第一量化系数在当前块中对应的区域均不相交时,解码端可以将当前块中除N个第一量化系数外的非零量化区域划分为N个区域,进而将这N个区域一一分配给N个第一量化系数,进而得到N个第一量化系数中每一个第一量化系数在当前块中对应的区域。
方式2,通过计算确定出N个第一量化系数中每一个第一量化系数在当前块中对应的区域,即上述S502-A包括如下S502-A1和S502-A2的步骤:
S502-A1、确定第i个第一量化系数的扫描索引;
S502-A2、根据扫描索引和当前块中的第一量化系数的个数,确定第i个第一量化系数在当前块中对应的区域。
在该方式2中,以N个第一量化系数中的第i个第一量化系数为例,第i个第一量化系数的扫描索引可以理解为第i个第一量化系数在N个第一量化系数中的解码扫描序号。本申请实施例中,解码端通过确定第i个第一量化系数的扫描索引,进而根据第i个第一量化系数的扫描索引和当前块中第一量化系数的个数N,准确确定出该第i个第一量化系数在当前块中对应的区域。
本申请实施例对上述S502-A1中确定第i个第一量化系数的扫描索引的具体方式不做限制。例如,将第i个第一量化系数在当前块中的位置索引,确定为该第i个第一量化系数的扫描索引。举例说明,假设第i个第一量化系数为图6中位置索引2处的量化系数,则可以将位置索引2,确定为该第i个第一量化系数的扫描索引。
在一种可能的实现方式中,还可以根据第i个第一量化系数在N个第一量化系数中的扫描顺序,确定第i个第一量化系数的扫描索引。
例如,将第i个第一量化系数在N个第一量化系数中的解码序号,确定为该第i个第一量化系数的扫描索引。例如,第i个第一量化系数为N个第一量化系数中第2个解码的量化系数,因此,可以确定第i个第一量化系数的扫描索引为2。
再例如,若第i个第一量化系数为N个第一量化系数中的第j个被扫描量化系数时,则确定第i个第一量化系数的扫描索引为N-j。举例说明,假设N等于3,即当前块包括3个第一量化系数,则3个第一量化系数的解码扫描顺序为先解码扫描第一量化系数3,再解码扫描第一量化系数2,最后解码扫描第一量化系数1,因此,可以确定第一量化系数1的扫描索引为0,第一量化系数2的扫描索引为1,第一量化系数3的扫描索引为2。也就是说,本申请实施例中,N个第一量化系数的扫描索引,逆着扫描顺序的方向,扫描索引为0~N–1。
根据上述方法,确定出第i个第一量化系数的扫描索引后,根据该第i个第一量化系数的扫描索引和当前块中的第一量化系数的个数,确定第i个第一量化系数在当前块中对应的区域。
在一种示例中,根据当前块中第一量化系数的个数,将当前块划分为N个区域,其中N个区域中每一个区域包括至少一个非零量化系数。接着,根据N个第一量化系数中每一个第一量化系数的扫描索引,将划分得到的N个区域一一分配给每一个第一量化系数。举例说明,N=3,3个第一量化系数的扫描索引为1、2和3,3个区域分别为区域1、区域2和区域3,这样,可以确定区域1为扫描索引1对应的第一量化系数在当前块中对应的区域,确定区域2为扫描索引2对应的第一量化系数在当前块中对应的区域,确定区域3为扫描索引3对应的第一量化系数在当前块中对应的区域。
在另一种示例中,上述S502-A2包括如下步骤:
S502-A21、根据第i个第一量化系数的扫描索引、当前块中的第一量化系数的个数和第一阈值,确定第一扫描索引和第二扫描索引;
S502-A22、根据当前块的扫描顺序,将当前块中第一扫描索引和第二扫描索引内的区域,确定为第i个第一量化系数在当前块中对应的区域。
在示例中,解码端通过第i个第一量化系数的扫描索引、当前块中的第一量化系数的个数和第一阈值,确定第i个第一量化系数在当前块中对应的区域的两个边界,将这两个边界内的区域,确定为该第i个第一量化系数在当前块中对应的区域,进而提高了第i个第一量化系数在当前块中对应的区域的确定准确性。
上述第一扫描索引START i和第二扫描索引END i可以理解为第i个第一量化系数在当前块中对应的区域的扫描索引序号区间。
本申请实施例对上述S502-A21中根据第i个第一量化系数的扫描索引、当前块中的第一量化系数的个数和第一阈值,确定第一扫描索引和第二扫描索引的具体方式不做限制,只要保证第一扫描索引和第二扫描索引不同,且第一扫描索引和第二扫描索引确定的区域属于当前块,且包括当前块中的至少一个非零量化系数即可。
示例性的,解码端根据第i个第一量化系数的扫描索引、当前块中的第一量化系数的个数和第一阈值,确定第一数值;进而根据第一数值,确定第一扫描索引。
本申请实施例对根据第i个第一量化系数的扫描索引、当前块中的第一量化系数的个数和第一阈值,确定第一数值的方式不做限制。例如,将第i个第一量化系数的扫描索引与第一预设值相加,得到第一和值;将第一阈值与第二预设值相减,得到第一差值;将第一和值与第一差值相乘,得到第一乘积;将第一乘积与当前块中的第一量化系数的个数相加后,再减去第三预设值,得到第一数值。
本申请实施例对上述第一预设值、第二预设值、第三预设值的具体取值不做限制。示例性的,第一预设值、第二预设值、第三预设值的至少一个为1。
根据上述方法,解码端确定出第一数值后,根据第一数值,确定第一扫描索引,例如,将第一数值,确定为第一扫描索引。
上述第一扫描索引START i的值不应当超过当前块中扫描顺序上的第一个非零量化系数的扫描索引,因此,在一种可能的实现方式中,解码端根据当前块的量化系数的个数,确定第二数值;将第一数值和第二数值中的最小值,确 定为第一扫描索引。
本申请实施例对上述解码端根据当前块的量化系数的个数,确定第二数值的方式不做限制。
例如,将当前块的量化系数的个数,确定为第二数值。
再例如,将当前块的量化系数的个数与第四预设值的差值,确定为第二数值。本申请实施例对第四预设值的具体取值不做限制,具体根据实际需要确定。
在一种可能的实现方式中,解码端通过如下公式(5),确定第一扫描索引START i
START i=min((i+a)×(M-b)+N-c,N coeff-d)    (5)
其中,i为第i个第一量化系数的扫描索引,M为第一阈值,N为当前块中第一量化系数的个数,N coeff为当前块中量化系数的个数,a为第一预设值,b为第二预设值,c为第三预设值,d为第四预设值。
在一种示例中,若a、b、c和d均为1时,则上述公式(5)可以表达为如下公式(6):
START i=min((i+1)×(M-1)+N-1,N coeff-1)    (6)
上述对第一扫描索引的确定过程进行介绍。下面对第二扫描索引的确定过程进行介绍。
本申请实施例对上述S502-A21中,根据第i个第一量化系数的扫描索引、当前块中的第一量化系数的个数和第一阈值,确定第二扫描索引的具体方式不做限制。
在一种可能的实现方式中,解码端将第一阈值与第五预设值相减,得到第二差值;将第i个第一量化系数的扫描索引与第二差值相乘,得到第二乘积;将第二乘积与当前块中的第一量化系数的个数相加,得到第二扫描索引。
示例性的,解码端通过如下公式(7),确定第二扫描索引END i
END i=i×(M-e)+N    (7)
其中,e为第五预设值。
本申请实施例对上述第五预设值的具体取值不做限制。
可选的,第五预设值e=1,此时,上述公式(7)可以表达为如下公式(8):
END i=i×(M-1)+N    (8)
解码端根据上述方法,确定出第i个第一量化系数对应的第一扫描索引START i和第二扫描索引END i,接着,根据当前块的扫描顺序,将当前块中第一扫描索引和第二扫描索引内的区域,确定为第i个第一量化系数在当前块中对应的区域。
为了进一步介绍本申请实施例的技术方案,下面通过一具体的实施例,对上述确定N个第一量化系数和N个第一量化系数中每一个第一量化系数在当前块中对应的区域进行介绍。
举例说明,假设当前块的大小为8x8,该当前块使用的扫描方式为zig-zag,假定索引21为当前块中按解码顺序扫描的第一个非零系数,则系数解码时按照21,20,….,0的顺序进行系数的解码过程。也就是说,本申请实施例中,当前块的量化系数的个数为22,假设第一阈值为16,这样根据当前块的量化系数的个数22和第一阈值16,确定当前块中的第一量化系数的个数N,假设确定出N=2。示例性的,根据扫描顺序,将当前块的左上角区域中的2个量化系数,确定为2个第一量化系数,例如图7所示,这2个第一量化系数为当前块中位置索引0和位置索引1处的两个量化系数。
接着,根据上述公式(7)和(8),确定出位置索引0对应的第一量化系数1在当前块中对应的区域为[2,16],位置索引1对应的第一量化系数2在当前块中对应的区域为[17,21]。
如图7所示,本申请实施例中,当前块的N个第一量化系数位于当前块的左上角区域内,相比于图8所示的,当前块的N个第一量化系数分散在当前块的整个区域,例如图8中的2个第一量化系数为位置索引0和位置索引1处的量化系数,本申请实施例通过将当前块的N个第一量化系数集中在当前块的左上角区域内,由于左上角区域内的量化系数的值较大,因此对左上角区域内的量化系数进行隐藏时,可以有效提高量化系数的第一特性的隐藏效果,进而有效降低编码代价。
解码端根据上述方法,确定出N个第一量化系数中每一个第一量化系数在当前块中对应的区域后,执行如下S503的步骤。
S503、根据第i个第一量化系数在当前块中对应的区域的第二特性,确定第i个第二量化系数的第一特性。
本申请实施例中,为了降低编码代价,编码端对第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数,并对第i个第一量化系数进行编码,以降低编码代价,同时使用第i个第一量化系数在当前块中对应的区域的第二特性,来指示第i个第二量化系数的第一特性。这样,解码端在解码第i个第一量化系数时,首先根据上述方法,确定出第i个第一量化系数在当前块中对应的区域,接着,根据第i个第一量化系数在当前块中对应的区域的第二特性,确定第i个第二量化系数被隐藏的第一特性,进而根据第i个第二量化系数的第一特性和第i个第一量化系数,确定第i个第二量化系数。
上述第二特性可以为二值化特性,例如0或1。也就是说,本申请实施例中,可以通过第i个第一量化系数在当前块中对应的区域的二值化特性(0或1),确定第i个第二量化系数的第一特性。例如图7所示,根据区域[2,16]对应的二值化特性,确定位置索引0处的第二量化系数的第一特性,根据区域[17,21]对应的二值化特性,确定位置索引1处的第二量化系数的第一特性。
本申请实施例对第一特性和第二特性不做限制。
在一些实施例中,第一特性与第二特性可以相同。
在一些实施例中,第一特性与第二特性不同。
在一种示例中,第一特性为第i个第二量化系数的正负号,第二特性可以为第i个第二量化系数在当前块中对应 区域的正负号或奇偶性。
在另一种示例中,第一特性为第i个第二量化系数的奇偶性,第二特性可以为第i个第二量化系数在当前块中对应区域的正负号或奇偶性。
本申请实施例中,区域的第二特性可以理解为该区域中所包括的量化系数对应的第二特性,例如,第二特性为奇偶性时,则该区域的奇偶性为该区域中量化系数的个数奇偶性或绝对值和的奇偶性,或者该区域中量化系数的其他特征的奇偶性。
在一些实施例中,若第一特性和第二特性均为奇偶性时,上述S503包括如下S503-A:
S503-A、根据区域的奇偶性,确定第i个第二量化系数的奇偶性。
其中区域的奇偶性可以理解为该区域中量化系数的个数或绝对值之和的奇偶性。
为了便于描述,后续实施例所述的该区域指第i个第一量化系数在当前块中对应的区域。
示例1,若第i个第二量化系数的奇偶性,通过该区域所包括的量化系数的第一绝对值之和的奇偶性进行标识,即该区域的奇偶性为该区域中量化系数的第一绝对值之和的奇偶性,此时,上述S503-A包括:根据该区域中量化系数的第一绝对值之和的奇偶性,确定第i个第二量化系数的奇偶性。
其中,量化系数的第一绝对值为该量化系数的部分或全部绝对值,例如第一绝对值为量化系数的绝对值中小于16的部分。
本申请实施例中,量化系数的绝对值用一个或多个标识指示,若该量化系数的绝对值大于15,则该量化系数的绝对值还包括超出15的部分。
基于此,本申请实施例中,量化系数的全部绝对值,指的是解码出的关于该量化系数的整个绝对值,包括各标识位的值,若该量化系数的绝对值大于15时,还包括超过15部分的值。
可选的,量化系数的绝对值中的部分绝对值指标识位中的全部或部分标识位的值,例如解码端根据该区域中量化系数的标识1至标识5的值的绝对值之和的奇偶性,确定第i个第二量化系数的奇偶性。
例如,若第i个第一量化系数在当前块中对应的区域中量化系数的第一绝对值之和为偶数,则确定第i个第二量化系数为偶数。
需要说明的是,该示例1中,若第i个第二量化系数的奇偶性与该区域中量化系数的第一绝对值之和的奇偶性不一致时,则编码端对该区域中量化系数中的至少一个系数的奇偶性进行修改。例如,若第i个第二量化系数为奇数,而该区域中量化系数的第一绝对值之和为偶数,此时,将该区域中量化系数中最小量化系数加1或减1,以将该区域中量化系数的第一绝对值之和修改为奇数。再例如,若第i个第二量化系数为偶数,而该区域中量化系数的第一绝对值之和为奇数,此时,将该区域中量化系数中最小量化系数加1或减1,以将该区域中量化系数的第一绝对值之和修改为偶数。
示例性2,若该区域的奇偶性为该区域中目标量化系数的个数的奇偶性,此时,上述S503-A包括:确定该区域中的目标量化系数,并根据该区域中目标量化系数的个数奇偶性,确定第i个第二量化系数的奇偶性。
上述目标量化系数为该区域中的非零量化系数、值为偶数的非零量化系数、值为偶数的量化系数、值为奇数的量化系数中的任意一个。
在一种示例中,若目标量化系数为该区域中的非零量化系数,则可以根据该区域中非零量化系数的个数奇偶性,确定该第i个第二量化系数的奇偶性。
例如,若该区域中非零量化系数的个数为奇数,则确定第i个第二量化系数为奇数。
例如,若该区域中非零量化系数的个数为偶数,则确定第i个第二量化系数为偶数。
需要说明的是,该示例中,若第i个第二量化系数的奇偶性与该区域中非零量化系数的个数的奇偶性不一致时,则编码端对该区域中的至少一个系数进行修改。例如,若第i个第二量化系数为奇数,而该区域中非零量化系数的个数为偶数,则可以将该区域中的一个为零的量化系数调整为1,或者,将该区域中最小的一个量化系数的值调整为0,以使该区域中非零量化系数的个数为奇数。再例如,若第i个第二量化系数为偶数,而该区域中非零量化系数的个数为奇数,则可以将该区域中的一个为零的量化系数调整为1,或者,将该区域中最小的一个量化系数的值调整为0,以使该区域中非零量化系数的个数为偶数。
在另一种示例中,若目标量化系数为该区域中值为偶数的非零量化系数,则可以根据该区域中值为偶数的非零量化系数的个数奇偶性,确定该第i个第二量化系数的奇偶性。
例如,若该区域中值为偶数的非零量化系数的个数为奇数,则确定第i个第二量化系数为奇数。
例如,若该区域中值为偶数的非零量化系数的个数为偶数,则确定第i个第二量化系数为偶数。
需要说明的是,该示例中,若第i个第二量化系数的奇偶性与该区域中值为偶数的非零量化系数的个数的奇偶性不一致时,则编码端对该区域中的至少一个系数进行修改。例如,若第i个第二量化系数为奇数,而该区域中值为偶数的非零量化系数的个数为偶数,则可以将该区域中的一个为零的量化系数调整为2,或者,将该区域中最小的一个非零量化系数的值加1或减1,以使该区域中值为偶数的非零量化系数的个数为奇数。再例如,若第i个第二量化系数为偶数,而该区域中值为偶数的非零量化系数的个数为奇数,则可以将该区域中的一个为零的量化系数调整为2,或者,将该区域中最小的一个非零量化系数的值加1或减1,以使该区域中非零量化系数的个数为偶数。
在另一种示例中,若目标量化系数为该第区域中值为偶数的量化系数,则可以根据该区域中值为偶数的量化系数的个数奇偶性,确定该第i个第二量化系数的奇偶性。该值为偶数的量化系数中包括值为0的量化系数。
例如,若该区域中值为偶数的量化系数的个数为奇数,则确定第i个第二量化系数为奇数。
例如,若该区域中值为偶数的量化系数的个数为偶数,则确定第i个第二量化系数为偶数。
需要说明的是,该示例中,若第i个第二量化系数的奇偶性与该区域中值为偶数的量化系数的个数的奇偶性不一致时,则编码端对该区域中的至少一个系数进行修改。例如,若第i个第二量化系数为奇数,而该区域中值为偶数的 量化系数的个数为偶数,则可以将该区域中的一个为零的量化系数调整为1,或者,将该区域中最小的一个非零量化系数调整为0,以使该区域中值为偶数的量化系数的个数为奇数。再例如,若第i个第二量化系数为偶数,而该区域中值为偶数的量化系数的个数为奇数,则可以将该区域中的一个为零的量化系数调整为1,或者,将该区域中最小的一个非零量化系数调整为0,以使该区域中量化系数的个数为偶数。
在另一种示例中,若目标量化系数为该区域中值为奇数的量化系数,则可以根据该区域中值为奇数的量化系数的个数奇偶性,确定该第i个第二量化系数的奇偶性。
例如,若该区域中值为奇数的量化系数的个数为奇数,则确定第i个第二量化系数为奇数。
例如,若该区域中值为奇数的量化系数的个数为偶数,则确定第i个第二量化系数为偶数。
需要说明的是,该示例中,若第i个第二量化系数的奇偶性与该区域中值为奇数的量化系数的个数的奇偶性不一致时,则编码端对该区域中的至少一个系数进行修改。例如,若第i个第二量化系数为奇数,而该区域中值为奇数的量化系数的个数为偶数,则可以将该区域中的一个为零的量化系数调整为1,或者,将该区域中最小的一个非零量化系数调整为0或加1或减1,以使该区域中值为奇数的量化系数的个数为奇数。再例如,若第i个第二量化系数为偶数,而该区域中值为奇数的量化系数的个数为奇数,则可以将该区域中的一个为零的量化系数调整为1,或者,将该区域中最小的一个非零量化系数调整为0或加1或减1,以使该区域中量化系数的个数为偶数。
可选的,编码端使用率失真代价最小的调整方式,对该区域中的至少一个系数进行调整。
由上述可知,本申请实施例,根据该区域对应的预设特征的奇偶性,确定第i个第二量化系数的奇偶性。
根据上述各方式,确定出第i个第二量化系数的奇偶性后,执行如下步骤S504。
S504、根据第i个第一量化系数和第i个第二量化系数的第一特性,确定第i个第二量化系数。
由上述可知,本申请实施例中,为了降低编码代价,编码端第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数,由于第i个第二量化系数的第一特性被隐藏,因此,通过当前块中第i个第一量化系数对应的区域的第二特性进行标识。这样解码端在解码时,首先解码码流,确定出当前块中的N个第一量化系数,针对N个第一量化系数中的第i个第一量化系数,确定该第i个第一量化系数在当前块中对应的区域,进而根据该区域,确定出第i个第二量化系数被隐藏的第一特性。最后,可以根据第i个第一量化系数及第i个第二量化系数的第一特性,可以重建出具有第一特性的第二量化系数,即可以实现第一特性被隐藏系数的重建。
在一些实施例中,若第一特性为正负号时,则可以根据上述解码出的第i个第一量化系数,以及第i个第二量化系数的正负号,确定出具有正负号的第i个第二量化系数。
在一些实施例中,若第一特性为奇偶性时,则解码端根据第i个第一量化系数和第i个第二量化系数的奇偶性,确定第i个第二量化系数。
其中,解码端根据第i个第二量化系数的奇偶性不同,采用不同的方式重建第i个第二量化系数。
情况1,若第i个第二量化系数为奇数,则采用第一运算方式对第i个第一量化系数进行运算,得到第i个第二量化系数。
解码端采用的第一运算方式,与编码端确定第i个第一量化系数的第三运算方式对应。
本申请实施例对上述第一运算方式和第三运算方式的具体形式不做限制,其中第一运算方式可以理解为第三运算方式的逆运算。
方式1,对于非零量化系数,若编码端采用的第三运算方式为将第i个第二量化系数的值加一除以二,作为该第i个第一量化系数。对应的,解码端采用的第一运算方式为第i个第二量化系数的值等于第i个第一量化系数乘以二减一。
示例性的,第一运算方式如公式(9)所示:
C=2*val-1      (9)
其中,C为第i个第二量化系数,val为第i个第一量化系数。
在该方式1中,若第i个第二量化系数为奇数时,根据上述公式(9)所示的第一运算方式,确定出第i个第二量化系数。
举例说明,假设第i个第一量化系数为5,该第i个第一量化系数在当前块中对的区域包括5个像素点,通过解码码流,得到这5个像素点对应的量化系数分别为:6、3、2、1、1。示例性的,根据该区域中量化系数的第一绝对值之和的奇偶性确定第i个第二量化系数的奇偶性,该区域中5个量化系数的第一绝对值之和为13,是奇数,则确定第i个第二量化系数为奇数。这样,解码端可以根据上述公式(9),重建出第i个第二量化系数的值为5*2-1=9。
由上述示例可知,将原本值为9的第i个第二量化系数,通过本申请实施例的奇偶隐藏技术,隐藏为5,可以减少编码所需的比特数,大大降低了编码代价。
需要说明的是,上述公式(9)只是本申请实施例涉及的第一运算方式的一种示例,本申请实施例的第一运算方式包括但不限于上述公式(9)。
情况2,若第i个第二量化系数为偶数,则采用第二运算方式对第i个第一量化系数进行运算,得到第i个第二量化系数。
解码端采用的第二运算方式,与编码端确定第i个第一量化系数的第四运算方式对应。
本申请实施例对上述第二运算方式和第四运算方式的具体形式不做限制,其中第二运算方式可以理解为第四运算方式的逆运算。
在一种可能的实现方式中,若编码端采用的第四运算方式为将第i个第二量化系数的值除以二,作为第i个第一量化系数。对应的,解码端采用的第二运算方式为第i个第二量化系数的值等于第i个第一量化系数乘以二。
示例性的,第二运算方式如公式(10)所示:
C=2*val      (10)
其中,C为第i个第二量化系数,val为第i个第一量化系数。
在示例中,若第i个第二量化系数为偶数时,根据上述公式(10)所示的第二运算方式,确定出第i个第二量化系数。
举例说明,假设第i个第一量化系数为4,该第i个第一量化系数在当前块中对的区域包括5个像素点,通过解码码流,得到这5个像素点对应的量化系数分别为:6、3、1、1、1。示例性的,根据该区域中量化系数的第一绝对值之和的奇偶性确定第i个第二量化系数的奇偶性,该区域中5个量化系数的第一绝对值之和为12,是偶数,则确定第i个第二量化系数为偶数。这样,解码端可以根据上述公式(10),重建出第i个第二量化系数的值为4*2=8。
由上述示例可知,将原本值为8的第i个第二量化系数,通过本申请实施例的方法,处理为值为4的第i个第一量化系数,可以减少编码所需的比特数,降低了编码代价。
在一些实施例中,解码端可以通过如下方式,确定出第i个第二量化系数,即上述S504包括如下步骤:
S504-A1、采用预设运算方式对第i个第一量化系数进行运算,得到运算结果;
S504-A2、根据第i个第二量化系数的奇偶性和运算结果,得到第i个第二量化系数。
本申请实施例对上述预设运算方式的具体形式不做限制。
在一些实施例中,上述预设运算方式包括第i个第一量化系数乘以二,也就是说,将第i个第一量化系数的值乘以2,得到运算结果。
接着,根据第i个第二量化系数的奇偶性和上述运算结果,得到第i个第二量化系数,例如,将运算结果与预设值之和,确定为第i个第二量化系数的值。在一些实施例中,该预设值也称为奇偶性。若第i个第二量化系数为奇数,则预设值为1,若第i个第二量化系数为偶数,则预设值为0。
示例性的,解码端可以根据如下公式(11),确定出第i个第二量化系数:
Quant[pos]=Quant[pos]*2+parity      (11)
其中,等号右侧的Quant[pos]为第i个第一量化系数,等号左侧的Quant[pos]为重建得到的第i个第二量化系数,parity为预设值,若第i个第二量化系数为奇数时,则该parity=1,若第i个第二量化系数为奇数时,则该parity=0。
由上述公式(11)可知,解码码流,得到量化系数Quant[pos],若该量化系数为第i个第一量化系数,则该第i个第二量化系数等于Quant[pos]乘以2后加上奇偶性对应的值。
解码端,根据上述方法,可以确定出N个第一量化系数中每一个第一量化系数对应的第二量化系数,当前块中各第二量化系数,以及其他奇偶性未被隐藏的量化系数组成当前块的量化系数。接着,根据当前块的量化系数,确定当前块的重建值。
在一些实施例中,若编码端跳过变换步骤,直接对当前块的残差值进行量化。对应的,解码端对当前块的量化系数进行反量化,得到当前块的残差值。另外,采用帧内预测和/或帧间预测方法,确定出当前块的预测值,将当前块的预测值与重建值相加,得到当前块的重建值。
在一些实施例中,若编码端未跳过变换步骤,即编码端对当前块的残差值进行变换,得到变换系数,对变换系数进行量化。对应的,解码端对当前块的量化系数进行反量化,得到当前块的变换系数,对变换系数进行反变换,得到当前块的残差值。另外,采用帧内预测和/或帧间预测方法,确定出当前块的预测值,将当前块的预测值与重建值相加,得到当前块的重建值。
本申请实施例提供的种视频解码方法,解码端解码码流,确定当前块中的N个第一量化系数,N个第一量化系数中的第i个第一量化系数为对当前块中的第i个第二量化系数的第一特性进行隐藏后得到的量化系数,接着,确定第i个第一量化系数在当前块中对应的区域;根据第i个第一量化系数在当前块中对应的区域的第二特性,确定第i个第二量化系数的第一特性;根据第i个第一量化系数和第i个第二量化系数的第一特性,确定第i个第二量化系数。即本申请实施例,对当前块中的N个第二量化系数的第一特性进行隐藏,得到N个第一量化系数,在编码时对N个第一量化系数进行编码,可以减少编码所需的比特数,降低视频压缩代价。
在上述图5所示实施例的基础上,下面结合图9,对本申请实施例提供的视频解码方法做进一步说明。
图9为本申请一实施例提供的视频解码方法流程示意图。在该实施例中,以第一特性和第二特性均为奇偶性为例,如图9所示,本申请实施例的方法包括:
S601、解码码流,得到至少一个标志。
上述至少一个标志用于指示是否允许量化系数的奇偶性被隐藏。
可选的,上述至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志中的至少一个。
具体的,解码端首先解码码流,得到上述至少一个标志,根据这至少一个标志,判断当前块是否允许量化系数的奇偶性被隐藏。
若根据上述至少一个标志,确定当前块不允许量化系数的奇偶性被隐藏时,则执行如下S602和S609的步骤,即解码码流,得到当前块的已解码信息,该已解码信息中包括当前块的量化系数,此时,由于当前块中的量化系数未进行奇偶性隐藏,则执行进行后续的反量化过程。
若根据上述至少一个标志,确定当前块允许量化系数的奇偶性被隐藏时,则执行如下S602至S608的步骤。
S602、解码码流,得到当前块的已解码信息。
上述当前块的已解码信息中包括当前块中的量化系数。
示例性的,解码端首先解码标识1到标识5,接着按照从最后一个非零系数至变换块左上角的扫描顺序,解码每个量化系数的绝对值超出15的部分,最终得的当前块中各量化系数。因此,在一些实施例中,本申请实施例中,当前 块的已解码信息包括绝对值中未超过15部分的量化系数。
S603、根据当前块的已解码信息,确定当前块的N个第一量化系数。
本申请实施例对确定当前块的N个第一量化系数的方式不做限制。
在一些实施例中,当前块的已解码信息中还包括当前块的量化系数的个数。此时,解码端可以根据当前块的量化系数的个数,确定N个第一量化系数。
在一些实施例中,上述N个第一量化参数位于当前块的左上角区域。
上述S603的具体实现过程可以参照上述S501的相关描述,在此不再赘述。
S604、确定第i个第一量化系数在当前块中对应的区域。
示例性的,根据当前块中的第一量化系数的个数,确定第i个第一量化系数在当前块中对应的区域。
例如,确定第i个第一量化系数的扫描索引;根据该扫描索引和当前块中的第一量化系数的个数,确定第i个第一量化系数在当前块中对应的区域。
在一种示例中,解码端可以根据第i个第一量化系数在N个第一量化系数中的扫描顺序,确定第i个第一量化系数的扫描索引。例如,若第i个第一量化系数为N个第一量化系数中的第j个被扫描量化系数时,则确定第i个第一量化系数的扫描索引为N-j。
在一种示例中,根据第i个第一量化系数的扫描索引、当前块中的第一量化系数的个数和第一阈值,确定第一扫描索引和第二扫描索引;根据当前块的扫描顺序,将当前块中第一扫描索引和第二扫描索引内的区域,确定为第i个第一量化系数在当前块中对应的区域。
上述S604的具体实现过程可以参照上述S502的相关描述,在此不再赘述。
S605、判断第i个第一量化系数在当前块中对应的区域是否满足预设条件。
本申请实施例中,对本申请提出的奇偶性隐藏技术进行限定。具体是,若第i个第一量化系数在当前块中对应的区域满足设定的预设条件时,则说明该区域使用本申请实施例提供的奇偶性隐藏技术可以得到显著的有益效果,此时,执行如下S606至S608的步骤。若该区域不满足设定的预设条件时,说明该区域使用本申请实施例提供的奇偶性隐藏技术无法达到显著的有益效果,此时,执行如下S609的步骤。
本申请实施例对上述预设条件的具体内容不做限制,可以根据实际需要设定。
在一种可能的实现方式中,上述预设条件包括如下至少一个条件:
条件1,该区域中非零量化系数的个数大于第一数值;
条件2,该区域中,位于扫描顺序上的第一个非零量化系数与最后一个非零量化系数之间距离大于第二数值;
条件3,该区域中,位于扫描顺序上的第一个非零量化系数与最后一个量化系数之间距离大于第三数值;
条件4,该区域中,非零量化系数的绝对值之和大于第四数值。
在该实现方式中,若该区域满足上述4个条件中的至少一个条件时,则执行如下S606至S608的步骤。
在一些实施例中,上述4个条件还可以相互组合,形成新的约束条件。
本申请实施例对上述第一数值至第四数值的具体取值不做限制,只有第一数值至第四数值均为正整数即可。
在一种示例中,上述第一数值、第二数值、第三数值和第四数值中的至少一个为固定值。
在另一种示例中,上述第一数值、第二数值、第三数值和第四数值中的至少一个为非固定值,即为编码端根据当前编码信息确定的数值。
在一些实施例中,若第一数值、第二数值、第三数值和第四数值中的至少一个为非固定值时,则编码端将该非固定值写入码流。
根据上述预设条件,确定出该区域满足上预设条件时,则说明该区域对应的量化系数的第一特性(例如奇偶性)被隐藏,此时执行如下步骤S606。
S606、根据第i个第一量化系数在当前块中对应的区域的奇偶性,确定第i个第二量化系数的奇偶性。
示例的,根据该区域的第一绝对值之和的奇偶性,确定第i个第二量化系数的奇偶性。
示例的,根据该区域中目标量化系数的个数奇偶性,确定第i个第二量化系数的奇偶性。
上述目标量化系数为该区域中的非零量化系数、值为偶数的非零量化系数、值为偶数的量化系数、值为奇数的量化系数中的任意一个。
上述S606的具体实现过程可以参照上述S503的相关描述,在此不再赘述。
S607、根据第i个第一量化系数和第i个第二量化系数的奇偶性,确定第i个第二量化系数。
例如,若第i个第二量化系数为奇数,则将第i个第一量化系数乘以二加一的值,确定为第i个第二量化系数的值。
再例如,若第i个第二量化系数为奇数,则将第i个第一量化系数乘以二减一的值,确定为第i个第二量化系数的值。
再例如,若第i个第二量化系数为偶数,则将第i个第一量化系数乘以二的值,确定为第i个第二量化系数的值。
S608、根据第i个第二量化系数,确定当前块的量化系数。
根据上述方法,确定出当前块中奇偶性被隐藏的量化系数,结合解码出的当前块中奇偶性未被隐藏的其他量化系数,得到当前块的量化系数。
S609、根据当前块的已解码信息,确定当前块的量化系数。
若当前区域不包括奇偶性被隐藏的量化系数,则将码流中解码出的量化系数,作为当前块最终的量化系数。
S610、根据当前块的量化系数,得到当前块的重建值。
根据上述方法,确定出当前块的量化系数,通过如下两种方式,确定当前块的重建值。
方式1,若编码端跳过变换步骤,直接对当前块的残差值进行量化。对应的,解码端对当前块的量化系数进行反 量化,得到当前块的残差值。另外,采用帧内预测和/或帧间预测方法,确定出当前块的预测值,将当前块的预测值与重建值相加,得到当前块的重建值。
方式2,若编码端未跳过变换步骤,即编码端对当前块的残差值进行变换,得到变换系数,对变换系数进行量化。对应的,解码端对当前块的量化系数进行反量化,得到当前块的变换系数,对变换系数进行反变换,得到当前块的残差值。另外,采用帧内预测和/或帧间预测方法,确定出当前块的预测值,将当前块的预测值与重建值相加,得到当前块的重建值。
本申请实施例,为奇偶性隐藏技术设置预设条件,在解码时,首先判断区域是否满足预设条件,若区域满足预设条件时,确定该区域对应的量化系数的奇偶性被隐藏,进而采用本申请提出的奇偶性隐藏技术对当前块中的第一量化系数进行解码,提高解码准确性。
示例性的,本申请实施例对应的编解码语法如表2所示:
表2
Figure PCTCN2022097683-appb-000006
Figure PCTCN2022097683-appb-000007
Figure PCTCN2022097683-appb-000008
上述表2中SBBSIZE表示每个区域的大小,示例的SBBSIZE为16,,变量SUBSIZE和HPCTHRESH,其中,SUBSIZE用于标识当前块的每个区域的大小,HPCTHRESH用于标识每个区域中打开奇偶隐藏技术需要的区域中非零系数个数大于某个阈值。
根据上述实施方案即SBBSIZE每个区域大小为16。SBBTHRESH用于标识每个区域中打开奇偶隐藏技术需要的区域中非零系数个数大于某个阈值,示例性的该阈值为4。remainder表示量化系数中绝对值大于15的部分,sign表示量化系数的符号,即正负号。
本申请实施例,解码端在解码第一量化系数时,首先判断该第一量化系数对应的区域是否满足预设条件,以确定对该区域对应的第二量化系数采用本申请提供的奇偶性隐藏技术进行解码时,是否可以带来显著的有益技术效果,在确定采用该奇偶性隐藏技术具有显著的有益效果时,采用本申请的技术方案对第一量化系数进行解码,进而提高解码可靠性。
上文对本申请实施例涉及的视频解码方法进行了描述,在此基础上,下面针对编码端,对本申请涉及的视频解码方法进行描述。
图10为本申请实施例提供的视频编码方法的一种流程示意图。本申请实施例的执行主体可以为上述图1和图2所示的编码器。
如图10所示,本申请实施例的方法包括:
S701、确定当前块的N个第二量化系数,N为正整数。
本申请实施例中,为了降低编码代价,编码端对当前块中的N个第二量化系数的第一特性进行隐藏,得到N个第一量化系数,例如,编码端对第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数。这样,在编码时,编码端对N个第一量化系数进行编码,而不是对N个第二量化系数进行编码。由于N个第一量化系数是对N个第二量化系数的第一特性进行隐藏得到的,因此,N个第一量化系数的编码值小于N个第二量化系数,这样对编码值较小的N个第一量化系数进行编码时,可以使用更少的比特数,进而降低了编码代价。
在一些实施例中,上述第二量化系数是对变换系数进行量化得到的。例如,编码端对当前块进行预测,得到当前块的预测值,当前块的原始值与预测值进行相减,得到当前块的残差值。编码端对残差值进行变换,得到当前块的变换系数,接着,对变换系数进行量化,得到第二量化系数。
在一些实施例中,上述第二量化系数是对残差值进行量化得到的。例如,编码端对当前块进行预测,得到当前块的预测值,当前块的原始值与预测值进行相减,得到当前块的残差值。编码端对残差值进行量化,得到第二量化系数。
本申请实施例对当前块中N个第二量化系数的具体位置不做限制。例如图6所示,N个第二量化系数为索引为48、32、16和0四个位置上的系数。
在一些实施例中,变换使得当前块的能量主要集中在左上角区域内,也就是说,当前块的非零量化系数主要集中 在当前块的左上角区域,当前块的右下角区域中的量化系数通常为0。基于此,为了有效的降低编码代价,则本申请实施例的N个第二量化参数位于当前块的左上角区域内。例如,N个第二量化系数为位置索引为0、1、2、4等上的量化系数。
上述S701中,确定当前块的N个第二量化系数的方法包括但不限于如下几种:
方式一,当前块中N个第二量化系数的位置为预设的,或默认的。
方式二,通过如下S701-A和S701-B确定当前块的N个第二量化系数:
S701-A、确定当前块的量化系数的个数;
S701-B、根据当前块的量化系数的个数,确定N个第二量化系数。
需要说明的是,S701-A中所述的当前块的量化系数的个数是指当前块需要编码的量化系数的个数,例如图5中,编码端从当前块中位置索引21处的量化系数开始向左上角位置索引0处的量化系数进行编码,需要编码的量化系数的个数合计22,因此,可以确定当前块的量化系数的个数为22。
在本申请实施例中,若当前块所包括的量化系数较少时,则编码代价较小,此时,编码端可以直接对数量较少的量化系数进行直接编码,而无需进行隐藏。若当前块所包括的量化系数较多时,编码端的编码代价较大,此时,为了降低编码代价,则可以对当前块中的部分量化系数的第一特性进行隐藏,以降低编码代价。由此可知,当前块所包括的量化系数的个数,会影响编码代价,因此,在该方式二中,通过当前块所包括的量化系数的个数,确定当前块中的N个第二量化系数,进一步降低编码代价。
在该方式二中,编码端确定出当前块的量化系数的个数后,根据当前块的量化系数的个数,确定当前块的N个第二量化系数。
例如,若当前块的量化系数的个数小于预设值1时,则将当前块中位于左上角的一个量化系数,确定为第二量化系数。
再例如,若当前块的量化系数的个数小于预设值2时,则将当前块中位于左上角的两个相邻的量化系数,分别确定为第二量化系数,得到2个第二量化系数。在一种示例中,两个相邻的量化系数可以是空间位置上相邻的量化系数。在另一种示例中,两个相邻的量化系数为扫描顺序上相邻的两个量化系数。
在一些实施例中,编码端将当前块的量化系数的个数写入码流中。
在一些实施例中,可以通过如下S701-B1至S701-B3的步骤,确定出N个第二量化系数:
S701-B1、确定第一阈值;
S701-B2、根据当前块的量化系数的个数和第一阈值,确定当前块中的第二量化系数的个数;
S701-B3、根据当前块中的第二量化系数的个数,将当前块的左上角区域中的N个量化系数,确定为N个第二量化系数。
在该实施例中,编码端可以根据当前块的量化系数的个数,来计算当前块中的第二量化系数的个数,进而根据第二量化系数的个数N,确定当前块的N个第二量化系数。
具体的,编码端确定第一阈值,接着,根据该第一阈值与上述确定的当前块的量化系数的个数,确定当前块中第二量化系数的个数N,进而将当前块的左上角区域中的N个量化系数,确定为N个第二量化系数。
本申请实施例对上述S701-B1中确定第一阈值的方法不做限制。
例如,上述第一阈值为预设值或为默认值,这样编码端可以将该预设值或默认值确定为第一阈值。
本申请实施例对该第一阈值的具体取值不做限制,例如可以为16、8、4等。
编码端确定出第一阈值后,执行S701-B2,根据当前块的量化系数的个数和第一阈值,确定当前块中的第二量化系数的个数。本申请实施例对上述S701-B2的具体实现方式不做限制。
在一种示例中,将当前块的量化系数的个数和第一阈值的比值的整数部分,确定为当前块中的第二量化系数的个数。
在另一种示例中,将当前块的量化系数的个数和第一阈值的比值的四舍五入值,确定为当前块中的第二量化系数的个数。
在又一种示例中,将当前块的量化系数的个数和第一阈值的比值向上取值后的值,确定为当前块中的第二量化系数的个数。
例如,根据上述公式(4),确定当前块中的第二量化系数的个数。
根据上述方法,确定出当前块中第二量化系数的个数N后,执行上述S701-B3,以根据当前块中的第二量化系数的个数,将当前块的左上角区域中的N个量化系数,确定为N个第二量化系数。
本申请实施例对上述S701-B3的具体实现方式不做限制。
在一种可能的实现方式中,将当前块的左上角区域中的任意N个量化系数,确定为N个第二量化系数。例如,这N个第二量化系数为当前块左上角区域中,空间位置上相邻或部分相邻或均不相邻的N个量化系数。
在另一种可能的实现方式中,根据扫描顺序,将当前块的左上角区域中的N个量化系数,确定为N个第二量化系数。
例如,将当前块的左上角区域中,在解码顺序上相邻的N个量化系数,确定为N个第二量化系数。
再例如,将当前块中位于扫描顺序的后N个量化系数,确定为N个第二量化系数。假设N=2,则将图6中,索引0和索引1对应的2个量化系数,确定为2个第二量化系数。
在一些实施例中,可以通过至少一个标志来指示当前块是否允许采用本申请实施例提供的量化系数第一特性被隐藏的技术。在一些实施例中,本申请实施例提供的量化系数的第一特性被隐藏的技术也称为第一特性隐藏技术。
示例性的,设置的至少一个标志可以是不同级别的标志,用于指示对应级别是否允许量化系数的第一特性被隐藏。
可选的,上述至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志中的至少一个。
例如,上述至少一个标志包括序列级标志,该序列级标志用于指示当前序列是否允许量化系数的第一特性被隐藏。例如,若该序列级标志的取值为1时,指示当前序列允许量化系数的第一特性被隐藏,若该序列级标志的取值为0时,指示当前序列不允许量化系数的第一特性被隐藏。
可选的,若至少一个标志包括序列级标志时,该序列级标志可以位于序列头(sequence header)中。
再例如,上述至少一个标志包括图像级标志,该图像级标志用于指示当前图像是否允许量化系数的第一特性被隐藏。例如,若该图像级标志的取值为1时,指示当前图像允许量化系数的第一特性被隐藏,若该图像级标志的取值为0时,指示当前图像不允许量化系数的第一特性被隐藏。
可选的,若至少一个标志包括图像级标志时,该图像级标志可以位于图像头(picture header)中。
再例如,上述至少一个标志包括片级标志,该片级标志用于指示当前片(slice)是否允许量化系数的第一特性被隐藏。例如,若该片级标志的取值为1时,指示当前片允许量化系数的第一特性被隐藏,若该片级标志的取值为0时,指示当前片不允许量化系数的第一特性被隐藏。
可选的,若至少一个标志包括片级标志时,该片级标志可以位于片头(slice header)中。
再例如,上述至少一个标志包括单元级标志,该单元级标志用于指示当前CTU是否允许量化系数的第一特性被隐藏。例如,若该单元级标志的取值为1时,指示当前CTU允许量化系数的第一特性被隐藏,若该单元级标志的取值为0时,指示当前CTU不允许量化系数的第一特性被隐藏。
再例如,上述至少一个标志包括块级标志,该块级标志用于指示当前块是否允许量化系数的第一特性被隐藏。例如,若该块级标志的取值为1时,指示当前块允许量化系数的第一特性被隐藏,若该块级标志的取值为0时,指示当前块不允许量化系数的第一特性被隐藏。
这样,编码端首先得到上述至少一个标志,根据这至少一个标志,判断当前块是否允许量化系数的奇偶性被隐藏。若根据上述至少一个标志,确定当前块不允许量化系数的第一特性被隐藏时,则跳过本申请实施例的方法。若根据上述至少一个标志,确定当前块允许使用本申请实施例提供的第一特性隐藏技术时,则执行本申请实施例的方法。
在一些实施例中,本申请实施例提供的第一特性隐藏技术,与目标变换方式互斥,其中目标变换方式包括二次变换或多次变换等。此时,编码端在确定当前块采用目标变换方式进行变换时,则跳过本申请实施例提供的技术方案。
S702、针对N个第二量化系数中的第i个第二量化系数,对第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数,i为小于或等于N的正整数。
本申请实施例中,对N个第二量化系数中每一个第二量化系数的第一特性进行隐藏,得到对应的第一量化系数的过程相同,为了便于描述,在此以N个第二量化系数中的第i个第二量化系数为例进行说明。
本申请实施例,为了降低编码代价,对第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数,并将该第i个第一量化系数编入码流,而不是将该第i个第二量化系数编码码流。由于第i个第一量化系数通常小于第i个第二量化系数,因此,对第i个第一量化系数进行编码,相比于编码第i个第二量化系数,所需要的比特数减少,进而降低了编码代价。
本申请实施例对第二量化系数的第一特性不做限制。
在一些实施例,第一特性为第二量化系数的正负号。
在一些实施例中,第一特性为第二量化系数的奇偶性,此时,上述S702中对第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数包括如下步骤:
S702-A、对第i个第二量化系数的奇偶性进行隐藏,得到第i第一量化系数。
其中第i个第二量化系数的奇偶性通过第i个第二量化系数在当前块中对应的区域所对应的奇偶性进行标识。
本申请实施例对第i个第二量化系数进行奇偶性隐藏,得到第i个第一量化系数的方式不做限制。
在一些实施例中,可根据第i个第二量化系数的奇偶性,选择不同的方式,确定第i个第一量化系数,具体如情况1和情况2所示。
情况1,若第i个第二量化系数为奇数,则采用第三运算方式对第二量化系数进行运算,得到第i个第一量化系数。
本申请实施例上述第三运算方式的具体形式不做限制。
方式1,第三运算方式包括第i个第一量化系数等于第二量化系数的值加一除以二。
示例性的,第三运算方式如公式(12)所示:
val=(A+1)/2      (12)
其中,A为第i个第二量化系数,val为第i个第一量化系数。
在方式1中,若第i个第二量化系数为奇数时,根据上述公式(12)所示的第三运算方式,对第i个第二量化系数进行奇偶性隐藏,得到第i个第一量化系数。例如,第i个第二量化系数的值为9,则根据上述公式(12)确定出该第i个第一量化系数的值为5,编码数值5相比于编码数值9可以减少比特数,降低编码代价。
需要说明的是,上述公式(12)只是本申请实施例涉及的第三运算方式的一种示例,本申请实施例的第三运算方式包括但不限于上述公式(12)。
情况2,若第i个第二量化系数为偶数,则采用第四运算方式对第i个第二量化系数进行运算,得到第i个第一量化系数。
本申请实施例上述第四运算方式的具体形式不做限制。
示例性的,第四运算方式包括第i个第一量化系数等于第i个第二量化系数的值除以二。
例如,第四运算方式如公式(13)所示:
val=A/2     (13)
在情况2中,若第i个第二量化系数为偶数时,根据上述公式(13)所示的第四运算方式,对第i个第二量化系数进行奇偶性隐藏,得到第i个第一量化系数。例如,第i个第二量化系数的值为10,则根据上述公式(13)确定出该第i个第一量化系数的值为5,编码数值5相比于编码数值10可以减少比特数,降低编码代价。
需要说明的是,上述公式(13)只是本申请实施例涉及的第四运算方式的一种示例,本申请实施例的第四运算方式包括但不限于上述公式(13)。
在一些实施例中,则编码端可以根据第i个第二量化系数的奇偶性,采用预设运算方式对第i个第二量化系数进行运算,得到第i个第一量化系数。
本申请对预设运算方式的具体取值不做限制,例如预设运算方式为第i个第二量化系数的值除以大于1的正整数。
示例性的,预设运算方式包括第i个第二量化系数的值除以二取整,其中取整可以理解为取商值操作,例如第i个第二量化系数的值为7,7除以2取值为3。
例如,编码端通过如下公式(14)确定出第i个第一量化系数:
Q b=Q//2    (14)
其中,Q表示第i个第二量化系数,Q b表示第i个第一量化系数,“//”表示取整运算。
由上述公式(14)可知,对于第i个第二量化系数,经过上述运算进行奇偶性隐藏,得到第i个第一量化系数,第i个第一量化系数的绝对值小于第i个第二量化系数的绝对值,在编码时所需的比特数少,进而降低编码代价。例如,第i个第二量化系数为10时,则只需要编码5即可,再例如,第i个第二量化系数为21时,则只需要编码10即可,大幅度减少编码所需的比特数。
S703、对第i个第一量化系数进行编码,得到码流。
根据上述方法,确定出第i个第一量化系数后,对该第i个第一量化系数进行编码,得到码流。
本申请实施例,第i个第二量化系数的第一特性通过第i个第二量化系数在当前块中对应的区域的第二特性进行标识。
例如,使用第i个第二量化系数在当前块中对应的区域的一种二值特性(0或1),指示第i个第二量化系数的奇偶性。
在一些实施例中,通过该区域的奇偶性指示第i个第二量化系数的奇偶性。其中区域的奇偶性可以理解为该区域中量化系数的个数或绝对值之和的奇偶性。
示例性的,该区域的奇偶性可以是该区域中最小量化系数、该区域中最大量化系数、该区域的绝对值之和、该区域中目标量化系数的个数等等的奇偶性。
本申请实施例使用该区域的奇偶性指示第i个第二量化系数的奇偶性,例如,使用该区域的奇偶性为奇数,来指示第i个第二量化系数为奇数,使用该区域的奇偶性为偶数,来指示第i个第二量化系数为偶数。
在一些实施例中,若该区域的奇偶性,与第i个第二量化系数的奇偶性不一致时,则本申请实施例的方法还包括如下步骤1和步骤2:
步骤1、确定第i个第二量化系数在当前块中对应的区域;
步骤2、对区域中的量化系数的个数或值进行调整,以使区域的奇偶性,与第二量化系数的奇偶性一致。
本申请实施例中,确定第i个第二量化系数在当前块中对应的区域的方式包括但不限于如下几种:
方式1,当前块中除N个第二量化系数外的区域划分为N个区域,将划分得到的N个区域一一分配给N个第二量化系数,进而得到N个第二量化系数中每个第二量化系数在当前块中对应的区域。
方式2,根据当前块中的第二量化系数的个数,确定第i个第二量化系数在当前块中对应的区域。
在一种示例中,确定第i个第一量化系数的扫描索引;根据扫描索引和当前块中的第一量化系数的个数,确定第i个第一量化系数在当前块中对应的区域。
在一些实施例中,根据所述第i个第二量化系数在所述N个第二量化系数中的扫描顺序,确定所述第i个第二量化系数的扫描索引。
在一些实施例中,若所述第i个第二量化系数为所述N个第二量化系数中的第j个被扫描量化系数时,则确定所述第i个第二量化系数的扫描索引为N-j。
编码端确定出第i个第一量化系数的扫描索引后,根据扫描索引和当前块中的第一量化系数的个数,确定第i个第一量化系数在当前块中对应的区域。
在一些实施例中,根据所述第i个第二量化系数的扫描索引、所述当前块中的第二量化系数的个数和所述第一阈值,确定第一扫描索引和第二扫描索引;根据所述当前块的扫描顺序,将所述当前块中所述第一扫描索引和所述第二扫描索引内的区域,确定为所述第i个第二量化系数在所述当前块中对应的区域。
在一些实施例中,确定第一扫描索引的方法包括:根据第i个第二量化系数的扫描索引、当前块中的第二量化系数的个数和第一阈值,确定第一数值。例如,将第i个第二量化系数的扫描索引与第一预设值相加,得到第一和值;将第一阈值与第二预设值相减,得到第一差值;将第一和值与第一差值相乘,得到第一乘积;将第一乘积与当前块中的第二量化系数的个数相加后,再减去第三预设值,得到第一数值。接着,根据第一数值,确定第一扫描索引。在一种示例中,根据当前块的量化系数的个数,确定第二数值,例如将当前块的量化系数的个数与第四预设值的差值,确定为第二数值,进而将第一数值和第二数值中的最小值,确定为第一扫描索引。
在一些实施例中,确定第二扫描索引的方法包括:将第一阈值与第五预设值相减,得到第二差值;将第i个第二量化系数的扫描索引与第二差值相乘,得到第二乘积;将第二乘积与当前块中的第二量化系数的个数相加,得到第二扫描索引。
本申请实施例中,编码端根据上述步骤,确定出第i个第二量化系数在当前块中对应的区域后,判断该区域的奇 偶性,与第i个第二量化系数的奇偶性不一致时,则对该区域中的量化系数的个数或值进行调整,以使该区域的奇偶性,与第i个第二量化系数的奇偶性一致
本申请实施例中,对第i个第二量化系数在当前块中对应的区域进行调整的方式,至少包括如下几种情况:
情况1,若第i个第二量化系数的奇偶性通过该区域的第一绝对值之和的奇偶性进行标识,则上述步骤2包括:对该区域的值进行调整,以使该区域的第一绝对值之和的奇偶性,与第i个第二量化系数的奇偶性一致。
其中,量化系数的第一绝对值为量化系数的部分或全部绝对值,例如,量化系数的第一绝对值为小于15部分的绝对值。
上述情况1包括如下两种示例:
示例1,若第i个第二量化系数为奇数,且该区域的第一绝对值之和为偶数时,则调整该区域的值,以使调整后的该区域的第一绝对值之和为奇数。
例如,若第i个第二量化系数为奇数,而该区域的第一绝对值之和为偶数,此时,将该区域中最小量化系数加1或减1,以将该区域的第一绝对值之和修改为奇数。
示例2,若第i个第二量化系数为偶数,且该区域的第一绝对值之和为奇数时,则调整该区域的取值,以使调整后的该区域的第一绝对值之和为偶数。
例如,第i个第二量化系数为偶数,而该区域的第一绝对值之和为奇数,此时,将该区域中最小量化系数加1或减1,以将该区域的第一绝对值之和修改为偶数。
情况2,若第i个第二量化系数的奇偶性通过该区域中目标量化系数的个数的奇偶性进行标识,则上述步骤2包括:对该区域的值进行调整,以使该区域中目标量化系数个数的奇偶性,与第i个第二量化系数的奇偶性一致。
上述示例2至少包括如下两种示例:
示例1,若第i个第二量化系数为奇数,且该区域中目标量化系数的个数为偶数,则调整该区域的取值,以使调整后的该区域中目标量化系数个数的奇数。
示例2,若第i个第二量化系数为偶数,且该区域中目标量化系数的个数为奇数,则调整该区域的取值,以使调整后的该区域中目标量化系数个数的偶数。
上述目标量化系数为该区域中的非零量化系数、值为偶数的非零量化系数、值为偶数的量化系数、值为奇数的量化系数中的任意一个。
在一种示例中,若目标量化系数为该区域中的非零量化系数,则编码端对该区域中的至少一个系数进行修改。例如,第i个第二量化系数为奇数,而该区域中非零量化系数的个数为偶数,则可以将该区域中的一个为零的量化系数调整为1,或者,将该区域中最小的一个量化系数的值调整为0,以使该区域中非零量化系数的个数为奇数。
再例如,第i个第二量化系数为偶数,而该区域中非零量化系数的个数为奇数,则可以将该区域中的一个为零的量化系数调整为1,或者,将该区域中最小的一个非零量化系数的值调整为0,以使该区域中非零量化系数的个数为偶数。
在另一种示例中,若目标量化系数为该区域中值为偶数的非零量化系数,则编码端对该区域中的至少一个系数进行修改。例如,第i个第二量化系数为奇数,而该区域中值为偶数的非零量化系数的个数为偶数,则可以将该区域中的一个为零的量化系数调整为2,或者,将该区域中最小的一个非零量化系数的值加1或减1,以使该区域中值为偶数的非零量化系数的个数为奇数。
再例如,第i个第二量化系数为偶数,而该区域中值为偶数的非零量化系数的个数为奇数,则可以将该区域中的一个为零的量化系数调整为2,或者,将该区域中最小的一个非零量化系数的值加1或减1,以使该区域中非零量化系数的个数为偶数。编码端使用率失真代价最小的调整方式,对该区域中的至少一个系数进行调整。
在另一种示例中,若目标量化系数为该区域中值为偶数的量化系数,则编码端对该区域中的至少一个系数进行修改。例如,第i个第二量化系数为奇数,而该区域中值为偶数的量化系数的个数为偶数,则可以将该区域中的一个为零的量化系数调整为1,或者,将该区域中最小的一个非零量化系数调整为0,以使该区域中值为偶数的量化系数的个数为奇数。
再例如,第i个第二量化系数为偶数,而该区域中值为偶数的量化系数的个数为奇数,则可以将该区域中的一个为零的量化系数调整为1,或者,将该区域中最小的一个非零量化系数调整为0,以使该区域中量化系数的个数为偶数。
在另一种示例中,若目标量化系数为该区域中值为奇数的量化系数,则编码端对该区域中的至少一个系数进行修改。例如,第i个第二量化系数为奇数,而该区域中值为奇数的量化系数的个数为偶数,则可以将该区域中的一个为零的量化系数调整为1,或者,将该区域中最小的一个非零量化系数调整为0或加1或减1,以使该区域中值为奇数的量化系数的个数为奇数。
再例如,第i个第二量化系数为偶数,而该区域中值为奇数的量化系数的个数为奇数,则可以将该区域中的一个为零的量化系数调整为1,或者,将该区域中最小的一个非零量化系数调整为0或加1或减1,以使该区域中量化系数的个数为偶数。
进一步的,将本申请提出的奇偶性隐藏技术实施在AVM参考软件上,使用的区域大小设置为16,奇偶性隐藏的开启非零系数个数阈值为4。当本申请的奇偶性隐藏技术对当前区域开启时,当前区域中非零系数小于等于15部分的绝对值和为奇数,则表示该区域扫描顺序上最后一个系数(即第二量化系数)为奇数,为偶数表示该区域扫描顺序上最后一个系数(即第二量化系数)为偶数。在全帧内AI配置下的编码性能YUV3分量上提升为0.21%/1.02%/1.05%。在随机接入RA配置下的编码性能YUV3分量的提升为0.29%/0.63%/0.72%。
本申请实施例提供的视频编码方法,编码端确定当前块的N个第二量化系数,N为正整数;针对N个第二量化系数中的第i个第二量化系数,对第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数,i为小于或等于 N的正整数;对第i个第一量化系数进行编码,得到码流。即本申请实施例,编码端对于第二量化系数的第一特性进行隐藏,得到第一量化系数,由于第一量化系数的绝对值小于第二量化系数,这样对第一量化系数进行编码相比于第二量化系数,可以减少编码比特数,进而降低编码代价。同时,通过第二量化系数对应的区域的第二特性对该第二量化系数的第一特性进行标识,以使解码端根据第二量化系数对应的区域的第二特性,确定出该第二量化系数的第一特性,进而根据该第二量化系数的第一特性和第一量化系数实现对该第二量化系数的准确重建。
在上述图10所示实施例的基础上,下面结合图11,对本申请实施例提供的视频编码方法做进一步说明。
图11为本申请一实施例提供的视频编码方法流程示意图。本申请实施例以第一特性和第二特性均为奇偶性为例,如图11所示,本申请实施例的方法包括:
S801、获得至少一个标志。
上述至少一个标志用于指示是否允许量化系数的奇偶性被隐藏。
可选的,至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志中的至少一个。
若根据至少一个标志,确定允许当前块的量化系数的奇偶性被隐藏时,则执行如下步骤S802。
若根据至少一个标志,确定不允许当前块的量化系数的奇偶性被隐藏时,则执行如下S802和步骤S807。
S802、确定当前块的N个第二量化系数。
S803、针对N个第二量化系数中的第i个第二量化系数,确定第i个第二量化系数在当前块中对应的区域。
上述S803的具体实现过程可以参照上述步骤1的相关描述,在此不再赘述。
S804、判断第i个第二量化系数在当前块中对应的区域是否满足预设条件。
本申请实施例中,对本申请提出的奇偶性隐藏技术进行限定。具体是,若当前区域满足设定的预设条件时,则说明第i个第二量化系数在所述当前块中对应的区域使用本申请实施例提供的奇偶性隐藏技术可以得到显著的有益效果,此时,执行如下S805的步骤。
若第i个第二量化系数在所述当前块中对应的区域不满足设定的预设条件时,说明该区域使用本申请实施例提供的奇偶性隐藏技术无法达到显著的有益效果,此时,执行如下S807的步骤。
本申请实施例对上述预设条件的具体内容不做限制,可以根据实际需要设定。
在一种可能的实现方式中,上述预设条件包括如下至少一个条件:
条件1,第i个第二量化系数在所述当前块中对应的区域中非零量化系数的个数大于第一数值;
条件2,该区域中,位于扫描顺序上的第一个非零量化系数与最后一个非零量化系数之间距离大于第二数值;
条件3,该区域中,位于扫描顺序上的第一个非零量化系数与最后一个量化系数之间距离大于第三数值;
条件4,该区域中,非零量化系数的绝对值之和大于第四数值。
在一些实施例中,上述4个条件还可以相互组合,形成新的约束条件。
本申请实施例对上述第一数值至第四数值的具体取值不做限制,只有第一数值至第四数值均为正整数即可。
在一种示例中,上述第一数值、第二数值、第三数值和第四数值中的至少一个为固定值。
在另一种示例中,上述第一数值、第二数值、第三数值和第四数值中的至少一个为非固定值,即为编码端根据当前编码信息确定的数值。
在一些实施例中,若第一数值、第二数值、第三数值和第四数值中的至少一个为非固定值时,则编码端将该非固定值写入码流,解码端从码流中解析出该非固定值。
S805、对第i个第二量化系数进行奇偶性隐藏,得到第i个第一量化系数。
S806、对第i个第一量化系数进行编码,得到码流。
上述S805和S805的步骤,可以参照上述S702和S703的描述,在此不再赘述。
S807、对第i个第二量化系数进行编码,得到码流。
本申请实施例,编码端在编码第二量化系数时,首先通过判断该第二量化系数对应的区域是否满足预设条件,来确定采用本申请提供的奇偶性隐藏技术进行编码时,是否可以带来显著的有益技术效果,在确定采用该奇偶性隐藏技术具有显著的有益效果时,采用本申请的技术方案对第二量化系数进行编码,提高编码可靠性。
应理解,图5至图8仅为本申请的示例,不应理解为对本申请的限制。
以上结合附图详细描述了本申请的优选实施方式,但是,本申请并不限于上述实施方式中的具体细节,在本申请的技术构思范围内,可以对本申请的技术方案进行多种简单变型,这些简单变型均属于本申请的保护范围。例如,在上述具体实施方式中所描述的各个具体技术特征,在不矛盾的情况下,可以通过任何合适的方式进行组合,为了避免不必要的重复,本申请对各种可能的组合方式不再另行说明。又例如,本申请的各种不同的实施方式之间也可以进行任意组合,只要其不违背本申请的思想,其同样应当视为本申请所公开的内容。
还应理解,在本申请的各种方法实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。另外,本申请实施例中,术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系。具体地,A和/或B可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
上文结合图5至图11,详细描述了本申请的方法实施例,下文结合图12至图15,详细描述本申请的装置实施例。
图12是本申请实施例提供的视频解码装置的示意性框图。
如图12所示,视频解码装置10包括:
解码单元11,用于解码码流,确定当前块的N个第一量化系数,所述N个第一量化系数中的第i个第一量化系数为对所述当前块中的第i个第二量化系数的第一特性进行隐藏后得到的量化系数,所述N为正整数,所述i为小于或 等于N的正整数;
区域确定单元12,用于确定所述第i个第一量化系数在所述当前块中对应的区域;
特性确定单元13,用于根据所述第i个第一量化系数在所述当前块中对应的区域的第二特性,确定所述第i个第二量化系数的第一特性;
系数确定单元14,用于根据所述第i个第一量化系数和所述第i个第二量化系数的第一特性,确定所述第i个第二量化系数。
在一些实施例中,所述N个第一量化系数位于所述当前块的左上角区域中。
在一些实施例中,解码单元11,具体用于解码所述码流,得到所述当前块的量化系数的个数;根据所述当前块的量化系数的个数,确定所述N个第一量化系数。
在一些实施例中,解码单元11,具体用于确定第一阈值;根据所述当前块的量化系数的个数和所述第一阈值,确定所述当前块中的第一量化系数的个数;根据所述当前块中的第一量化系数的个数,将所述当前块的左上角区域中的N个量化系数,确定为所述N个第一量化系数。
在一些实施例中,解码单元11,具体用于解码所述码流,得到所述第一阈值。
可选的,所述第一阈值为预设值。
在一些实施例中,解码单元11,具体用于将所述当前块的量化系数的个数和所述第一阈值的比值向上取值后的值,确定为所述当前块中的第一量化系数的个数。
在一些实施例中,解码单元11,具体用于根据扫描顺序,将所述当前块的左上角区域中的N个量化系数,确定为所述N个第一量化系数。
在一些实施例中,解码单元11,具体用于将所述当前块中位于所述扫描顺序的后N个量化系数,确定为所述N个第一量化系数。
在一些实施例中,区域确定单元12,具体用于根据所述当前块中的第一量化系数的个数,确定所述第i个第一量化系数在所述当前块中对应的区域。
在一些实施例中,区域确定单元12,具体用于确定所述第i个第一量化系数的扫描索引;根据所述扫描索引和所述当前块中的第一量化系数的个数,确定所述第i个第一量化系数在所述当前块中对应的区域。
在一些实施例中,区域确定单元12,具体用于根据所述第i个第一量化系数在所述N个第一量化系数中的扫描顺序,确定所述第i个第一量化系数的扫描索引。
在一些实施例中,区域确定单元12,具体用于若所述第i个第一量化系数为所述N个第一量化系数中的第j个被扫描量化系数时,则确定所述第i个第一量化系数的扫描索引为N-j。
在一些实施例中,区域确定单元12,具体用于根据所述第i个第一量化系数的扫描索引、所述当前块中的第一量化系数的个数和所述第一阈值,确定第一扫描索引和第二扫描索引;根据所述当前块的扫描顺序,将所述当前块中所述第一扫描索引和所述第二扫描索引内的区域,确定为所述第i个第一量化系数在所述当前块中对应的区域。
在一些实施例中,区域确定单元12,具体用于根据所述第i个第一量化系数的扫描索引、所述当前块中的第一量化系数的个数和所述第一阈值,确定第一数值;根据所述第一数值,确定所述第一扫描索引。
在一些实施例中,区域确定单元12,具体用于根据所述当前块的量化系数的个数,确定第二数值;将所述第一数值和所述第二数值中的最小值,确定为所述第一扫描索引。
在一些实施例中,区域确定单元12,具体用于将所述第i个第一量化系数的扫描索引与第一预设值相加,得到第一和值;将所述第一阈值与第二预设值相减,得到第一差值;将所述第一和值与所述第一差值相乘,得到第一乘积;将所述第一乘积与所述当前块中的第一量化系数的个数相加后,再减去第三预设值,得到所述第一数值。
在一些实施例中,区域确定单元12,具体用于将所述当前块的量化系数的个数与第四预设值的差值,确定为所述第二数值。
在一些实施例中,区域确定单元12,具体用于将所述第一阈值与第五预设值相减,得到第二差值;将所述第i个第一量化系数的扫描索引与所述第二差值相乘,得到第二乘积;将所述第二乘积与所述当前块中的第一量化系数的个数相加,得到所述第二扫描索引。
在一些实施例中,所述第一特性和所述第二特性均为奇偶性,特性确定单元13,具体用于根据所述区域的奇偶性,确定所述第i个第二量化系数的奇偶性,所述区域的奇偶性为所述区域中量化系数的个数或绝对值之和的奇偶性;对应的,系数确定单元14,具体用于根据所述第i个第一量化系数和所述第i个第二量化系数的奇偶性,确定所述第i个第二量化系数。
在一些实施例中,若所述区域的奇偶性为所述区域中量化系数的第一绝对值之和的奇偶性,则特性确定单元13,具体用于根据所述区域中量化系数的第一绝对值之和的奇偶性,确定所述第i个第二量化系数的奇偶性,所述第一绝对值为所述量化系数的部分或全部绝对值。
在一些实施例中,若所述区域的奇偶性为所述区域中目标量化系数的个数奇偶性,则特性确定单元13,具体用于确定所述区域中的目标量化系数;根据所述目标量化系数的个数奇偶性,确定所述第i个第二量化系数的奇偶性。
在一些实施例中,所述目标量化系数为所述区域中的非零量化系数、值为偶数的非零量化系数、值为偶数的量化系数、值为奇数的量化系数中的任意一个。
在一些实施例中,特性确定单元13,具体用于采用预设运算方式对所述第i个第一量化系数进行运算,得到运算结果;根据所述第i个第二量化系数的奇偶性和所述运算结果,得到所述第i个第二量化系数。
在一些实施例中,所述预设运算方式包括所述第i个第一量化系数的值乘以二。
在一些实施例中,特性确定单元13,具体用于若所述区域满足预设条件时,则根据所述区域,确定所述第i个第二量化系数的第一特性。
在一些实施中,所述预设条件包括如下至少一个:
所述区域中非零量化系数的个数大于第一数值;
所述区域中,位于扫描顺序上的第一个非零量化系数与最后一个非零量化系数之间距离大于第二数值;
所述区域中,位于扫描顺序上的第一个非零量化系数与最后一个量化系数之间距离大于第三数值;
所述区域中,非零量化系数的绝对值之和大于第四数值。
应理解,装置实施例与方法实施例可以相互对应,类似的描述可以参照方法实施例。为避免重复,此处不再赘述。具体地,图12所示的视频解码装置10可以对应于执行本申请实施例的方法中的相应主体,并且视频解码装置10中的各个单元的前述和其它操作和/或功能分别为了实现方法等各个方法中的相应流程,为了简洁,在此不再赘述。
图13是本申请实施例提供的视频编码装置的示意性框图。
如图13所示,视频编码装置20包括:
确定单元21,用于确定当前块的N个第二量化系数,所述N为正整数;
隐藏单元22,用于针对所述N个第二量化系数中的第i个第二量化系数,对所述第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数,所述i为小于或等于N的正整数;
编码单元23,用于对所述第i个第一量化系数进行编码,得到码流,所述第i个第二量化系数的第一特性通过所述第i个第二量化系数在所述当前块中对应的区域的第二特性进行标识。
在一些实施例中,所述N个第二量化系数位于所述当前块的左上角区域中。
在一些实施例中,确定单元21,具体用于确定所述当前块的量化系数的个数;根据所述当前块的量化系数的个数,确定所述N个第二量化系数。
在一些实施例中,确定单元21,具体用于确定第一阈值;根据所述当前块的量化系数的个数和所述第一阈值,确定所述当前块中的第二量化系数的个数;根据所述当前块中的第二量化系数的个数,将所述当前块的左上角区域中的N个量化系数,确定为所述N个第二量化系数。
在一些实施例中,确定单元21,具体用于将所述当前块的量化系数的个数和所述第一阈值的比值向上取值后的值,确定为所述当前块中的第二量化系数的个数。
在一些实施例中,确定单元21,具体用于根据扫描顺序,将所述当前块的左上角区域中的N个量化系数,确定为所述N个第二量化系数。
在一些实施例中,确定单元21,具体用于将所述当前块中位于所述扫描顺序的后N个量化系数,确定为所述N个第二量化系数。
可选的,所述第一阈值为预设值。
在一些实施例中,编码单元23,还用于将所述第一阈值写入码流中。
在一些实施例中,编码单元23,还用于将所述当前块的量化系数的个数写入码流中。
在一些实施例中,所述第一特性和所述第二特性均为奇偶性,隐藏单元22,具体用于对所述第i个第二量化系数的奇偶性进行隐藏,得到所述第i第一量化系数,所述第i个第二量化系数的奇偶性通过所述区域的奇偶性进行标识。
在一些实施例中,隐藏单元22,还用于确定所述第i个第二量化系数在所述当前块中对应的区域;若所述区域的奇偶性,与所述第二量化系数的奇偶性不一致时,则对所述区域中的量化系数的个数或值进行调整,以使所述区域的奇偶性,与所述第二量化系数的奇偶性一致,所述区域的奇偶性为所述区域中量化系数的个数或绝对值之和的奇偶性。
在一些实施例中,隐藏单元22,具体用于根据所述当前块中的第二量化系数的个数,确定所述第i个第二量化系数在所述当前块中对应的区域。
在一些实施例中,隐藏单元22,具体用于确定所述第i个第二量化系数的扫描索引;根据所述扫描索引和所述当前块中的第二量化系数的个数,确定所述第i个第二量化系数在所述当前块中对应的区域。
在一些实施例中,隐藏单元22,具体用于根据所述第i个第二量化系数在所述N个第二量化系数中的扫描顺序,确定所述第i个第二量化系数的扫描索引。
在一些实施例中,隐藏单元22,具体用于若所述第i个第二量化系数为所述N个第二量化系数中的第j个被扫描量化系数时,则确定所述第i个第二量化系数的扫描索引为N-j。
在一些实施例中,隐藏单元22,具体用于根据所述第i个第二量化系数的扫描索引、所述当前块中的第二量化系数的个数和所述第一阈值,确定第一扫描索引和第二扫描索引;根据所述当前块的扫描顺序,将所述当前块中所述第一扫描索引和所述第二扫描索引内的区域,确定为所述第i个第二量化系数在所述当前块中对应的区域。
在一些实施例中,隐藏单元22,具体用于根据所述第i个第二量化系数的扫描索引、所述当前块中的第二量化系数的个数和所述第一阈值,确定第一数值;根据所述第一数值,确定所述第一扫描索引。
在一些实施例中,隐藏单元22,具体用于根据所述当前块的量化系数的个数,确定第二数值;将所述第一数值和所述第二数值中的最小值,确定为所述第一扫描索引。
在一些实施例中,隐藏单元22,具体用于将所述第i个第二量化系数的扫描索引与第一预设值相加,得到第一和值;将所述第一阈值与第二预设值相减,得到第一差值;将所述第一和值与所述第一差值相乘,得到第一乘积;将所述第一乘积与所述当前块中的第二量化系数的个数相加后,再减去第三预设值,得到所述第一数值。
在一些实施例中,隐藏单元22,具体用于将所述当前块的量化系数的个数与第四预设值的差值,确定为所述第二数值。
在一些实施例中,隐藏单元22,具体用于将所述第一阈值与第五预设值相减,得到第二差值;将所述第i个第二量化系数的扫描索引与所述第二差值相乘,得到第二乘积;将所述第二乘积与所述当前块中的第二量化系数的个数相加,得到所述第二扫描索引。
在一些实施例中,若所述第二量化系数的奇偶性通过所述区域中量化系数的第一绝对值之和的奇偶性进行标识,隐藏单元22,具体用于对所述区域中的量化系数的值进行调整,以使所述区域中量化系数的第一绝对值之和的奇偶性,与所述第二量化系数的奇偶性一致。
在一些实施例中,若所述第二量化系数的奇偶性通过所述区域中目标量化系数的个数的奇偶性进行标识,则隐藏单元22,还用于对所述区域中的量化系数的值进行调整,以使所述区域中目标量化系数个数的奇偶性,与所述第二量化系数的奇偶性一致。
在一些实施例中,隐藏单元22,具体用于采用预设运算方式对所述第i个第二量化系数进行运算,得到所述第i个第一量化系数。
在一些实施例中,所述预设运算方式包括所述第i个第二量化系数的值除以二取整。
在一些实施例中,隐藏单元22,具体用于若所述区域满足预设条件时,对所述第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数。
在一些实施例中,所述预设条件包括如下至少一个:
所述区域中非零量化系数的个数大于第一数值;
所述区域中,位于扫描顺序上的第一个非零量化系数与最后一个非零量化系数之间距离大于第二数值;
所述区域中,位于扫描顺序上的第一个非零量化系数与最后一个量化系数之间距离大于第三数值;
所述区域中,非零量化系数的绝对值之和大于第四数值。
应理解,装置实施例与方法实施例可以相互对应,类似的描述可以参照方法实施例。为避免重复,此处不再赘述。具体地,图13所示的视频编码装置20可以对应于执行本申请实施例的方法中的相应主体,并且视频编码装置20中的各个单元的前述和其它操作和/或功能分别为了实现方法等各个方法中的相应流程,为了简洁,在此不再赘述。
上文中结合附图从功能单元的角度描述了本申请实施例的装置和系统。应理解,该功能单元可以通过硬件形式实现,也可以通过软件形式的指令实现,还可以通过硬件和软件单元组合实现。具体地,本申请实施例中的方法实施例的各步骤可以通过处理器中的硬件的集成逻辑电路和/或软件形式的指令完成,结合本申请实施例公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件单元组合执行完成。可选地,软件单元可以位于随机存储器,闪存、只读存储器、可编程只读存储器、电可擦写可编程存储器、寄存器等本领域的成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法实施例中的步骤。
图11是本申请实施例提供的电子设备的示意性框图。
如图11所示,该电子设备30可以为本申请实施例所述的视频编码器,或者视频解码器,该电子设备30可包括:
存储器33和处理器32,该存储器33用于存储计算机程序34,并将该程序代码34传输给该处理器32。换言之,该处理器32可以从存储器33中调用并运行计算机程序34,以实现本申请实施例中的方法。
例如,该处理器32可用于根据该计算机程序34中的指令执行上述方法中的步骤。
在本申请的一些实施例中,该处理器32可以包括但不限于:
通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等等。
在本申请的一些实施例中,该存储器33包括但不限于:
易失性存储器和/或非易失性存储器。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synch link DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DR RAM)。
在本申请的一些实施例中,该计算机程序34可以被分割成一个或多个单元,该一个或者多个单元被存储在该存储器33中,并由该处理器32执行,以完成本申请提供的方法。该一个或多个单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述该计算机程序34在该电子设备30中的执行过程。
如图11所示,该电子设备30还可包括:
收发器33,该收发器33可连接至该处理器32或存储器33。
其中,处理器32可以控制该收发器33与其他设备进行通信,具体地,可以向其他设备发送信息或数据,或接收其他设备发送的信息或数据。收发器33可以包括发射机和接收机。收发器33还可以进一步包括天线,天线的数量可以为一个或多个。
应当理解,该电子设备30中的各个组件通过总线系统相连,其中,总线系统除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。
图15是本申请实施例提供的视频编解码系统的示意性框图。
如图15所示,该视频编解码系统40可包括:视频编码器41和视频解码器42,其中视频编码器41用于执行本申请实施例涉及的视频编码方法,视频解码器42用于执行本申请实施例涉及的视频解码方法。
本申请还提供了一种计算机存储介质,其上存储有计算机程序,该计算机程序被计算机执行时使得该计算机能够执行上述方法实施例的方法。或者说,本申请实施例还提供一种包含指令的计算机程序产品,该指令被计算机执行时使得计算机执行上述方法实施例的方法。
本申请还提供了一种码流,该码流通过上述视频编码方法得到。
当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行该计算机程序指令时,全部或部分地产生按照本申请实施例该的流程或功能。该计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。该计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,该计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如数字视频光盘(digital video disc,DVD))、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,该单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。例如,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以该权利要求的保护范围为准。

Claims (61)

  1. 一种视频解码方法,其特征在于,包括:
    解码码流,确定当前块的N个第一量化系数,所述N个第一量化系数中的第i个第一量化系数为对所述当前块中的第i个第二量化系数的第一特性进行隐藏后得到的量化系数,所述N为正整数,所述i为小于或等于N的正整数;
    确定所述第i个第一量化系数在所述当前块中对应的区域;
    根据所述第i个第一量化系数在所述当前块中对应的区域的第二特性,确定所述第i个第二量化系数的第一特性;
    根据所述第i个第一量化系数和所述第i个第二量化系数的第一特性,确定所述第i个第二量化系数。
  2. 根据权利要求1所述的方法,其特征在于,所述N个第一量化系数位于所述当前块的左上角区域中。
  3. 根据权利要求1所述的方法,其特征在于,所述解码码流,确定当前块的N个第一量化系数,包括:
    解码所述码流,得到所述当前块的量化系数的个数;
    根据所述当前块的量化系数的个数,确定所述N个第一量化系数。
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述当前块的量化系数的个数,确定所述N个第一量化系数,包括:
    确定第一阈值;
    根据所述当前块的量化系数的个数和所述第一阈值,确定所述当前块中的第一量化系数的个数;
    根据所述当前块中的第一量化系数的个数,将所述当前块的左上角区域中的N个量化系数,确定为所述N个第一量化系数。
  5. 根据权利要求4所述的方法,其特征在于,所述确定第一阈值,包括:
    解码所述码流,得到所述第一阈值。
  6. 根据权利要求4所述的方法,其特征在于,所述第一阈值为预设值。
  7. 根据权利要求4所述的方法,其特征在于,所述根据所述当前块的量化系数的个数和所述第一阈值,确定所述当前块中的第一量化系数的个数,包括:
    将所述当前块的量化系数的个数和所述第一阈值的比值向上取值后的值,确定为所述当前块中的第一量化系数的个数。
  8. 根据权利要求4所述的方法,其特征在于,所述根据所述当前块中的第一量化系数的个数,将所述当前块的左上角区域中的N个量化系数,确定为所述N个第一量化系数,包括:
    根据扫描顺序,将所述当前块的左上角区域中的N个量化系数,确定为所述N个第一量化系数。
  9. 根据权利要求8所述的方法,其特征在于,所述根据扫描顺序,将所述当前块的左上角区域中的N个量化系数,确定为所述N个第一量化系数,包括:
    将所述当前块中位于所述扫描顺序的后N个量化系数,确定为所述N个第一量化系数。
  10. 根据权利要求4-9任一项所述的方法,其特征在于,所述确定所述第i个第一量化系数在所述当前块中对应的区域,包括:
    根据所述当前块中的第一量化系数的个数,确定所述第i个第一量化系数在所述当前块中对应的区域。
  11. 根据权利要求10所述的方法,其特征在于,所述根据所述当前块中的第一量化系数的个数,确定所述第i个第一量化系数在所述当前块中对应的区域,包括:
    确定所述第i个第一量化系数的扫描索引;
    根据所述扫描索引和所述当前块中的第一量化系数的个数,确定所述第i个第一量化系数在所述当前块中对应的区域。
  12. 根据权利要求11所述的方法,其特征在于,所述确定所述第i个第一量化系数的扫描索引,包括:
    根据所述第i个第一量化系数在所述N个第一量化系数中的扫描顺序,确定所述第i个第一量化系数的扫描索引。
  13. 根据权利要求12所述的方法,其特征在于,所述根据所述第i个第一量化系数在所述N个第一量化系数中的扫描顺序,确定所述第i个第一量化系数的扫描索引,包括:
    若所述第i个第一量化系数为所述N个第一量化系数中的第j个被扫描量化系数时,则确定所述第i个第一量化系数的扫描索引为N-j。
  14. 根据权利要求11所述的方法,其特征在于,所述根据所述扫描索引和所述当前块中的第一量化系数的个数,确定所述第i个第一量化系数在所述当前块中对应的区域,包括:
    根据所述第i个第一量化系数的扫描索引、所述当前块中的第一量化系数的个数和所述第一阈值,确定第一扫描索引和第二扫描索引;
    根据所述当前块的扫描顺序,将所述当前块中所述第一扫描索引和所述第二扫描索引内的区域,确定为所述第i个第一量化系数在所述当前块中对应的区域。
  15. 根据权利要求14所述的方法,其特征在于,所述根据所述第i个第一量化系数的扫描索引、所述当前块中的第一量化系数的个数和所述第一阈值,确定第一扫描索引,包括:
    根据所述第i个第一量化系数的扫描索引、所述当前块中的第一量化系数的个数和所述第一阈值,确定第一数值;
    根据所述第一数值,确定所述第一扫描索引。
  16. 根据权利要求15所述的方法,其特征在于,所述根据所述第一数值,确定所述第一扫描索引,包括:
    根据所述当前块的量化系数的个数,确定第二数值;
    将所述第一数值和所述第二数值中的最小值,确定为所述第一扫描索引。
  17. 根据权利要求15所述的方法,其特征在于,所述根据所述第i个第一量化系数的扫描索引、所述当前块中的 第一量化系数的个数和所述第一阈值,确定第一数值,包括:
    将所述第i个第一量化系数的扫描索引与第一预设值相加,得到第一和值;
    将所述第一阈值与第二预设值相减,得到第一差值;
    将所述第一和值与所述第一差值相乘,得到第一乘积;
    将所述第一乘积与所述当前块中的第一量化系数的个数相加后,再减去第三预设值,得到所述第一数值。
  18. 根据权利要求16所述的方法,其特征在于,所述根据所述当前块的量化系数的个数,确定第二数值,包括:
    将所述当前块的量化系数的个数与第四预设值的差值,确定为所述第二数值。
  19. 根据权利要求14所述的方法,其特征在于,根据所述第i个第一量化系数的扫描索引、所述当前块中的第一量化系数的个数和所述第一阈值,确定第二扫描索引,包括:
    将所述第一阈值与第五预设值相减,得到第二差值;
    将所述第i个第一量化系数的扫描索引与所述第二差值相乘,得到第二乘积;
    将所述第二乘积与所述当前块中的第一量化系数的个数相加,得到所述第二扫描索引。
  20. 根据权利要求1-9、11-19任一项所述的方法,其特征在于,所述第一特性和所述第二特性均为奇偶性,所述根据所述第i个第一量化系数在所述当前块中对应的区域,确定所述第i个第二量化系数的第一特性,包括:
    根据所述区域的奇偶性,确定所述第i个第二量化系数的奇偶性,所述区域的奇偶性为所述区域中量化系数的个数或绝对值之和的奇偶性;
    所述根据所述第i个第一量化系数和所述第i个第二量化系数的第一特性,确定所述第i个第二量化系数,包括:
    根据所述第i个第一量化系数和所述第i个第二量化系数的奇偶性,确定所述第i个第二量化系数。
  21. 根据权利要求20所述的方法,其特征在于,若所述区域的奇偶性为所述区域中量化系数的第一绝对值之和的奇偶性,则所述根据所述区域的奇偶性,确定所述第i个第二量化系数的奇偶性,包括:
    根据所述区域中量化系数的第一绝对值之和的奇偶性,确定所述第i个第二量化系数的奇偶性,所述第一绝对值为所述量化系数的部分或全部绝对值。
  22. 根据权利要求20所述的方法,其特征在于,若所述区域的奇偶性为所述区域中目标量化系数的个数奇偶性,则所述根据所述区域的奇偶性,确定所述第i个第二量化系数的奇偶性,包括:
    确定所述区域中的目标量化系数;
    根据所述目标量化系数的个数奇偶性,确定所述第i个第二量化系数的奇偶性。
  23. 根据权利要求22所述的方法,其特征在于,所述目标量化系数为所述区域中的非零量化系数、值为偶数的非零量化系数、值为偶数的量化系数、值为奇数的量化系数中的任意一个。
  24. 根据权利要求20所述的方法,其特征在于,所述根据所述第i个第一量化系数和所述第i个第二量化系数的奇偶性,确定所述第i个第二量化系数,包括:
    采用预设运算方式对所述第i个第一量化系数进行运算,得到运算结果;
    根据所述第i个第二量化系数的奇偶性和所述运算结果,得到所述第i个第二量化系数。
  25. 根据权利要求24所述的方法,其特征在于,所述预设运算方式包括所述第i个第一量化系数的值乘以二。
  26. 根据权利要求1-9、11-19任一项所述的方法,其特征在于,所述根据所述第i个第一量化系数在所述当前块中对应的区域,确定所述第i个第二量化系数的第一特性,包括:
    若所述区域满足预设条件时,则根据所述区域,确定所述第i个第二量化系数的第一特性。
  27. 根据权利要求26所述的方法,其特征在于,所述预设条件包括如下至少一个:
    所述区域中非零量化系数的个数大于第一数值;
    所述区域中,位于扫描顺序上的第一个非零量化系数与最后一个非零量化系数之间距离大于第二数值;
    所述区域中,位于扫描顺序上的第一个非零量化系数与最后一个量化系数之间距离大于第三数值;
    所述区域中,非零量化系数的绝对值之和大于第四数值。
  28. 一种视频编码方法,其特征在于,包括:
    确定当前块的N个第二量化系数,所述N为正整数;
    针对所述N个第二量化系数中的第i个第二量化系数,对所述第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数,所述i为小于或等于N的正整数;
    对所述第i个第一量化系数进行编码,得到码流,所述第i个第二量化系数的第一特性通过所述第i个第二量化系数在所述当前块中对应的区域的第二特性进行标识。
  29. 根据权利要求28所述的方法,其特征在于,所述N个第二量化系数位于所述当前块的左上角区域中。
  30. 根据权利要求28所述的方法,其特征在于,所述确定当前块的N个第二量化系数,包括:
    确定所述当前块的量化系数的个数;
    根据所述当前块的量化系数的个数,确定所述N个第二量化系数。
  31. 根据权利要求30所述的方法,其特征在于,所述根据所述当前块的量化系数的个数,确定所述N个第二量化系数,包括:
    确定第一阈值;
    根据所述当前块的量化系数的个数和所述第一阈值,确定所述当前块中的第二量化系数的个数;
    根据所述当前块中的第二量化系数的个数,将所述当前块的左上角区域中的N个量化系数,确定为所述N个第二量化系数。
  32. 根据权利要求31所述的方法,其特征在于,所述根据所述当前块的量化系数的个数和所述第一阈值,确定所述当前块中的第二量化系数的个数,包括:
    将所述当前块的量化系数的个数和所述第一阈值的比值向上取值后的值,确定为所述当前块中的第二量化系数的个数。
  33. 根据权利要求31所述的方法,其特征在于,所述根据所述当前块中的第二量化系数的个数,将所述当前块的左上角区域中的N个量化系数,确定为所述N个第二量化系数,包括:
    根据扫描顺序,将所述当前块的左上角区域中的N个量化系数,确定为所述N个第二量化系数。
  34. 根据权利要求33所述的方法,其特征在于,所述根据扫描顺序,将所述当前块的左上角区域中的N个量化系数,确定为所述N个第二量化系数,包括:
    将所述当前块中位于所述扫描顺序的后N个量化系数,确定为所述N个第二量化系数。
  35. 根据权利要求31所述的方法,其特征在于,所述第一阈值为预设值。
  36. 根据权利要求31所述的方法,其特征在于,所述方法还包括:
    将所述第一阈值写入码流中。
  37. 根据权利要求31所述的方法,其特征在于,所述方法还包括:
    将所述当前块的量化系数的个数写入码流中。
  38. 根据权利要求31-37任一项所述的方法,其特征在于,所述第一特性和所述第二特性均为奇偶性,所述对所述第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数,包括:
    对所述第i个第二量化系数的奇偶性进行隐藏,得到所述第i第一量化系数,所述第i个第二量化系数的奇偶性通过所述区域的奇偶性进行标识。
  39. 根据权利要求38所述的方法,其特征在于,所述方法还包括:
    确定所述第i个第二量化系数在所述当前块中对应的区域;
    若所述区域的奇偶性与所述第二量化系数的奇偶性不一致时,则对所述区域中的量化系数的个数或值进行调整,以使所述区域的奇偶性,与所述第二量化系数的奇偶性一致,所述区域的奇偶性为所述区域中量化系数的个数或绝对值之和的奇偶性。
  40. 根据权利要求39所述的方法,其特征在于,所述确定所述第i个第二量化系数在所述当前块中对应的区域,包括:
    根据所述当前块中的第二量化系数的个数,确定所述第i个第二量化系数在所述当前块中对应的区域。
  41. 根据权利要求40所述的方法,其特征在于,所述根据所述当前块中的第二量化系数的个数,确定所述第i个第二量化系数在所述当前块中对应的区域,包括:
    确定所述第i个第二量化系数的扫描索引;
    根据所述扫描索引和所述当前块中的第二量化系数的个数,确定所述第i个第二量化系数在所述当前块中对应的区域。
  42. 根据权利要求41所述的方法,其特征在于,所述确定所述第i个第二量化系数的扫描索引,包括:
    根据所述第i个第二量化系数在所述N个第二量化系数中的扫描顺序,确定所述第i个第二量化系数的扫描索引。
  43. 根据权利要求42所述的方法,其特征在于,所述根据所述第i个第二量化系数在所述N个第二量化系数中的扫描顺序,确定所述第i个第二量化系数的扫描索引,包括:
    若所述第i个第二量化系数为所述N个第二量化系数中的第j个被扫描量化系数时,则确定所述第i个第二量化系数的扫描索引为N-j。
  44. 根据权利要求41所述的方法,其特征在于,所述根据所述扫描索引和所述当前块中的第二量化系数的个数,确定所述第i个第二量化系数在所述当前块中对应的区域,包括:
    根据所述第i个第二量化系数的扫描索引、所述当前块中的第二量化系数的个数和所述第一阈值,确定第一扫描索引和第二扫描索引;
    根据所述当前块的扫描顺序,将所述当前块中所述第一扫描索引和所述第二扫描索引内的区域,确定为所述第i个第二量化系数在所述当前块中对应的区域。
  45. 根据权利要求44所述的方法,其特征在于,所述根据所述第i个第二量化系数的扫描索引、所述当前块中的第二量化系数的个数和所述第一阈值,确定第一扫描索引,包括:
    根据所述第i个第二量化系数的扫描索引、所述当前块中的第二量化系数的个数和所述第一阈值,确定第一数值;
    根据所述第一数值,确定所述第一扫描索引。
  46. 根据权利要求45所述的方法,其特征在于,所述根据所述第一数值,确定所述第一扫描索引,包括:
    根据所述当前块的量化系数的个数,确定第二数值;
    将所述第一数值和所述第二数值中的最小值,确定为所述第一扫描索引。
  47. 根据权利要求45所述的方法,其特征在于,所述根据所述第i个第二量化系数的扫描索引、所述当前块中的第二量化系数的个数和所述第一阈值,确定第一数值,包括:
    将所述第i个第二量化系数的扫描索引与第一预设值相加,得到第一和值;
    将所述第一阈值与第二预设值相减,得到第一差值;
    将所述第一和值与所述第一差值相乘,得到第一乘积;
    将所述第一乘积与所述当前块中的第二量化系数的个数相加后,再减去第三预设值,得到所述第一数值。
  48. 根据权利要求46所述的方法,其特征在于,所述根据所述当前块的量化系数的个数,确定第二数值,包括:
    将所述当前块的量化系数的个数与第四预设值的差值,确定为所述第二数值。
  49. 根据权利要求44所述的方法,其特征在于,根据所述第i个第二量化系数的扫描索引、所述当前块中的第二量化系数的个数和所述第一阈值,确定第二扫描索引,包括:
    将所述第一阈值与第五预设值相减,得到第二差值;
    将所述第i个第二量化系数的扫描索引与所述第二差值相乘,得到第二乘积;
    将所述第二乘积与所述当前块中的第二量化系数的个数相加,得到所述第二扫描索引。
  50. 根据权利要求39所述的方法,其特征在于,若所述第二量化系数的奇偶性通过所述区域中量化系数的第一绝对值之和的奇偶性进行标识,所述第一绝对值为所述量化系数的部分或全部绝对值,则所述对所述区域中的量化系数进行调整,包括:
    对所述区域中的量化系数的值进行调整,以使所述区域中量化系数的第一绝对值之和的奇偶性,与所述第二量化系数的奇偶性一致。
  51. 根据权利要求50所述的方法,其特征在于,若所述第二量化系数的奇偶性通过所述区域中目标量化系数的个数的奇偶性进行标识,则所述对所述区域中的量化系数进行调整,包括:
    对所述区域中的量化系数的值进行调整,以使所述区域中目标量化系数个数的奇偶性,与所述第二量化系数的奇偶性一致。
  52. 根据权利要求38所述的方法,其特征在于,所述对所述第i个第二量化系数的奇偶性进行隐藏,得到所述第i第一量化系数,包括:
    采用预设运算方式对所述第i个第二量化系数进行运算,得到所述第i个第一量化系数。
  53. 根据权利要求52所述的方法,其特征在于,所述预设运算方式包括所述第i个第二量化系数的值除以二取整。
  54. 根据权利要求28-37任一项所述的方法,其特征在于,所述对所述第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数,包括:
    若所述区域满足预设条件时,对所述第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数。
  55. 根据权利要求54所述的方法,其特征在于,所述预设条件包括如下至少一个:
    所述区域中非零量化系数的个数大于第一数值;
    所述区域中,位于扫描顺序上的第一个非零量化系数与最后一个非零量化系数之间距离大于第二数值;
    所述区域中,位于扫描顺序上的第一个非零量化系数与最后一个量化系数之间距离大于第三数值;
    所述区域中,非零量化系数的绝对值之和大于第四数值。
  56. 一种视频解码装置,其特征在于,包括:
    解码单元,用于解码码流,确定当前块的N个第一量化系数,所述N个第一量化系数中的第i个第一量化系数为对所述当前块中的第i个第二量化系数的第一特性进行隐藏后得到的量化系数,所述N为正整数,所述i为小于或等于N的正整数;
    区域确定单元,用于确定所述第i个第一量化系数在所述当前块中对应的区域;
    特性确定单元,用于根据所述第i个第一量化系数在所述当前块中对应的区域的第二特性,确定所述第i个第二量化系数的第一特性;
    系数确定单元,用于根据所述第i个第一量化系数和所述第i个第二量化系数的第一特性,确定所述第i个第二量化系数。
  57. 一种视频编码装置,其特征在于,包括:
    确定单元,用于确定当前块的N个第二量化系数,所述N为正整数;
    隐藏单元,用于针对所述N个第二量化系数中的第i个第二量化系数,对所述第i个第二量化系数的第一特性进行隐藏,得到第i个第一量化系数,所述i为小于或等于N的正整数;
    编码单元,用于对所述第i个第一量化系数进行编码,得到码流,所述第i个第二量化系数的第一特性通过所述第i个第二量化系数在所述当前块中对应的区域的第二特性进行标识。
  58. 一种视频编解码系统,其特征在于,包括视频编码器和视频解码器;
    所述视频解码器用于执行如权利要求1-27任一项所述的视频解码方法;
    所述视频编码器用于执行如权利要求28-55任一项所述的视频编码方法。
  59. 一种电子设备,其特征在于,包括:存储器,处理器;
    所述存储器,用于存储计算机程序;
    所述处理器,用于执行所述计算机程序以实现如上述权利要求1至27或28至55任一项所述方法。
  60. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行指令被处理器执行时用于实现如权利要求1至27或28至55任一项所述的方法。
  61. 一种码流,其特征在于,所述码流通过如权利要求28至55任一项所述的方法得到。
PCT/CN2022/097683 2022-06-08 2022-06-08 视频编解码方法、装置、设备、系统及存储介质 WO2023236113A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/097683 WO2023236113A1 (zh) 2022-06-08 2022-06-08 视频编解码方法、装置、设备、系统及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/097683 WO2023236113A1 (zh) 2022-06-08 2022-06-08 视频编解码方法、装置、设备、系统及存储介质

Publications (1)

Publication Number Publication Date
WO2023236113A1 true WO2023236113A1 (zh) 2023-12-14

Family

ID=89117251

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/097683 WO2023236113A1 (zh) 2022-06-08 2022-06-08 视频编解码方法、装置、设备、系统及存储介质

Country Status (1)

Country Link
WO (1) WO2023236113A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2675159A1 (en) * 2012-06-15 2013-12-18 BlackBerry Limited Multi-bit information hiding using overlapping subsets
CN105898300A (zh) * 2016-05-06 2016-08-24 西安电子科技大学 一种基于恢复变换系数的改进变换系数符号位隐藏方法
CN111819854A (zh) * 2018-03-07 2020-10-23 华为技术有限公司 用于协调多符号位隐藏和残差符号预测的方法和装置
US20200404308A1 (en) * 2018-03-07 2020-12-24 Huawei Technologies Co., Ltd. Method and apparatus for detecting blocks suitable for multiple sign bit hiding
WO2021179034A1 (en) * 2020-03-10 2021-09-16 Canon Kabushiki Kaisha Method, apparatus and system for encoding and decoding a block of video samples

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2675159A1 (en) * 2012-06-15 2013-12-18 BlackBerry Limited Multi-bit information hiding using overlapping subsets
CN105898300A (zh) * 2016-05-06 2016-08-24 西安电子科技大学 一种基于恢复变换系数的改进变换系数符号位隐藏方法
CN111819854A (zh) * 2018-03-07 2020-10-23 华为技术有限公司 用于协调多符号位隐藏和残差符号预测的方法和装置
US20200404308A1 (en) * 2018-03-07 2020-12-24 Huawei Technologies Co., Ltd. Method and apparatus for detecting blocks suitable for multiple sign bit hiding
WO2021179034A1 (en) * 2020-03-10 2021-09-16 Canon Kabushiki Kaisha Method, apparatus and system for encoding and decoding a block of video samples

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
YU XIANG, WANG J; HE D; MARTIN-COCHER G; CAMPBELL S: "Multiple Sign Bits Hiding", 8. JCT-VC MEETING; 1-2-2012 - 10-2-2012; SAN JOSE; (JOINT COLLABORATIVE TEAM ON VIDEO CODING DOC NR.: JCTVC-H0481, 3 May 2022 (2022-05-03) - 10 February 2012 (2012-02-10), pages 1 - 6, XP055947166 *

Similar Documents

Publication Publication Date Title
WO2020211765A1 (en) An encoder, a decoder and corresponding methods harmonzting matrix-based intra prediction and secoundary transform core selection
CN113784126A (zh) 图像编码方法、装置、设备及存储介质
CN116405686A (zh) 图像重建方法和装置
CN114885157A (zh) 位置相关预测组合的模式相关和大小相关块级限制的方法和装置
CN113411613B (zh) 对图像块进行视频译码的方法、解码设备和编/解码器
US20230042484A1 (en) Decoding method and coding method for unmatched pixel, decoder, and encoder
WO2023044868A1 (zh) 视频编解码方法、设备、系统、及存储介质
WO2023236113A1 (zh) 视频编解码方法、装置、设备、系统及存储介质
WO2023184250A1 (zh) 视频编解码方法、装置、设备、系统及存储介质
WO2023220946A1 (zh) 视频编解码方法、装置、设备、系统及存储介质
WO2023184248A1 (zh) 视频编解码方法、装置、设备、系统及存储介质
WO2022193390A1 (zh) 视频编解码方法与系统、及视频编解码器
WO2023122969A1 (zh) 帧内预测方法、设备、系统、及存储介质
WO2023122968A1 (zh) 帧内预测方法、设备、系统、及存储介质
WO2022174475A1 (zh) 视频编解码方法与系统、及视频编码器与视频解码器
WO2022155922A1 (zh) 视频编解码方法与系统、及视频编码器与视频解码器
WO2023173255A1 (zh) 图像编解码方法、装置、设备、系统、及存储介质
WO2022116105A1 (zh) 视频编解码方法与系统、及视频编码器与视频解码器
WO2022193389A1 (zh) 视频编解码方法与系统、及视频编解码器
WO2023220969A1 (zh) 视频编解码方法、装置、设备、系统及存储介质
WO2023220970A1 (zh) 视频编码方法、装置、设备、系统、及存储介质
WO2022217447A1 (zh) 视频编解码方法与系统、及视频编解码器
WO2024050723A1 (zh) 一种图像预测方法、装置及计算机可读存储介质
WO2023092404A1 (zh) 视频编解码方法、设备、系统、及存储介质
WO2023197229A1 (zh) 视频编解码方法、装置、设备、系统及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22945258

Country of ref document: EP

Kind code of ref document: A1