WO2019085942A1 - Sao模式决策方法、装置、电子设备及可读存储介质 - Google Patents

Sao模式决策方法、装置、电子设备及可读存储介质 Download PDF

Info

Publication number
WO2019085942A1
WO2019085942A1 PCT/CN2018/113021 CN2018113021W WO2019085942A1 WO 2019085942 A1 WO2019085942 A1 WO 2019085942A1 CN 2018113021 W CN2018113021 W CN 2018113021W WO 2019085942 A1 WO2019085942 A1 WO 2019085942A1
Authority
WO
WIPO (PCT)
Prior art keywords
ctu
mode
rate distortion
merge mode
sao
Prior art date
Application number
PCT/CN2018/113021
Other languages
English (en)
French (fr)
Inventor
范娟婷
张贤国
朱政
张二丽
金星
Original Assignee
北京金山云网络技术有限公司
北京金山云科技有限公司
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 北京金山云网络技术有限公司, 北京金山云科技有限公司 filed Critical 北京金山云网络技术有限公司
Publication of WO2019085942A1 publication Critical patent/WO2019085942A1/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/13Adaptive entropy coding, e.g. adaptive variable length coding [AVLC] or context adaptive binary arithmetic coding [CABAC]
    • 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/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • H04N19/147Data rate or code amount at the encoder output according to rate distortion criteria
    • 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/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/157Assigned coding mode, i.e. the coding mode being predefined or preselected to be further used for selection of another element or parameter
    • 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
    • H04N19/182Methods 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 the unit being a pixel
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
    • H04N19/96Tree coding, e.g. quad-tree coding

Definitions

  • the present application relates to the field of video coding technologies, and in particular, to an SAO mode decision method, apparatus, electronic device, and computer readable storage medium.
  • SAO Sample Adaptive Offset
  • HEVC High Efficiency Video Coding
  • the SAO parameter selection process is also called the SAO mode decision process.
  • the SAO parameters mainly include: an SAO type, an offset value set, and a merge mode, wherein the SAO type includes a skip mode, an EO (Edge Offset) mode, and a BO (Band Offset) mode.
  • a CTU Coding Tree Unit
  • a degree coding tree block is used for SAO mode decision respectively.
  • J1 is less than the optimal coding cost J0 of the CTU, then J0 is set equal to J1, and the SAO parameter of the CTU is generated.
  • J2 is smaller than J0, J0 is set to be equal to J2, and the SAO parameter of the CTU is updated. .
  • the present application provides an SAO mode decision method, apparatus, electronic device, and computer readable storage medium to improve coding efficiency.
  • the specific technical solutions are as follows:
  • an embodiment of the present application discloses an SAO mode decision method, where the method includes: performing pixel compensation on a coding tree unit CTU in a merge mode, determining an optimal merge mode, and determining the optimal merge mode.
  • the first rate distortion penalty C1 of the CTU in the optimal merge mode if the C1 is less than the preset first threshold, obtaining the sample adaptive compensation SAO parameter of the CTU based on the optimal merge mode; If less than the first threshold, pixel compensation is performed on the CTU in the EO mode to obtain a second rate distortion penalty C2; and the SAO parameters of the CTU are determined according to C2 and C1.
  • the coding tree unit CTU is pixel compensated in the merge mode, and the optimal merge mode and the first rate distortion cost C1 of the CTU in the optimal merge mode are determined, including:
  • the threshold C0 is set to a preset second threshold, wherein the second threshold is a value greater than the first threshold; and the CTU is pixel compensated in a left merge mode to obtain a third rate distortion penalty C3;
  • C3 is not less than C0
  • pixel compensation is performed on the CTU in the up merge mode to obtain a fourth rate distortion cost C4; and in a case where C3 is less than C0, the left merge mode is determined as an optimal merge mode, C0 is updated to C3; if C0 is less than a preset third threshold, determining that the first rate distortion cost C1 of the CTU is equal to C3 in the optimal merge mode, wherein the third threshold is less than a value of the second threshold; if C0 is not less than the third threshold, performing pixel compensation on the CTU in the up merge mode
  • the preset second threshold is: a current optimal coding cost of the CTU.
  • the performing pixel compensation on the CTU in the EO mode includes: a set of offset values obtained according to a preset pixel row interval and/or a preset pixel column interval in the EO mode.
  • the CTU performs pixel compensation.
  • determining an optimal merge mode and the first rate distortion cost C1 of the CTU in the optimal merge mode including Determining whether the CTU is the first CTU in the video frame; if the CTU is the first CTU in the video frame, performing pixel compensation on the CTU in the EO mode, and obtaining the location based on the EO mode Determining the SAO parameter of the CTU; performing pixel compensation on the coding tree unit CTU in the merge mode, determining an optimal merge mode and a first rate distortion cost C1 of the CTU in the optimal merge mode, including: The CTU is not the first CTU in the video frame, and the CTU is pixel compensated in the merge mode to determine the optimal merge mode and the first rate distortion cost C1 of the CTU in the optimal merge mode.
  • the pixel compensation of the CTU in the EO mode includes: selecting some or all EO types from each preset EO type of the EO mode; respectively, the selected EO type
  • the CTU performs pixel compensation to obtain a rate distortion cost of the CTU at each selected EO type selected; and a pixel compensation result corresponding to a rate distortion cost that minimizes the obtained rate distortion cost is determined as described in the EO mode.
  • CTU pixel compensation result is determined as described in the EO mode.
  • the CTU is pixel-compensated in an EO mode
  • the SAO parameter of the CTU is obtained based on an EO mode, including: performing pixel compensation on the CTU in an EO mode to obtain a fifth rate.
  • a distortion cost C5 determining whether C5 is less than a current optimal coding cost of the CTU; if C5 is not less than a current optimal coding cost of the CTU, ending the SAO mode decision of the CTU, and skipping the video frame where the CTU is located
  • the determining, according to C2 and C1, the SAO parameter of the CTU if: C2 is less than C1, obtaining an SAO parameter of the CTU based on an EO mode; and if C2 is not less than C1, based on the optimal The merge mode obtains the SAO parameter of the CTU.
  • an embodiment of the present application further discloses an SAO mode decision apparatus, where the apparatus includes: a mode determining module, configured to perform pixel compensation on a CTU in a merge mode, determine an optimal merge mode, and The first rate-distortion cost C1 of the CTU in the optimal merge mode; the first determining module is configured to determine whether C1 is less than a preset first threshold, and if C1 is less than the first threshold, triggering the first parameter Obtaining a module; if the C1 is not less than the first threshold, the trigger rate distortion cost obtaining module; the first parameter obtaining module is configured to obtain the SAO parameter of the CTU based on the optimal merge mode; the rate distortion cost Obtaining a module, configured to perform pixel compensation on the CTU in the EO mode to obtain a second rate distortion penalty C2; and a second parameter obtaining module configured to determine the SAO parameter of the CTU according to C2 and C1.
  • the mode determining module includes: a threshold determining submodule, a first rate distortion cost obtaining submodule, a first determining submodule, an optimal merge mode determining submodule, a second determining submodule, and a first rate.
  • a distortion cost determination submodule a second rate distortion cost obtaining submodule, a third judging submodule, a second rate distortion cost determining submodule, and a third rate distortion cost determining submodule;
  • the threshold determining submodule being set to target
  • the threshold C0 is set to a preset second threshold, wherein the second threshold is a value greater than the first threshold;
  • the first rate distortion cost obtaining submodule is set to be in the left merge mode
  • the CTU performs pixel compensation to obtain a third rate distortion penalty C3.
  • the first determining submodule is configured to determine whether C3 is less than C0.
  • the optimal merge mode determining submodule is triggered; if C3 is not less than C0 And triggering the second rate distortion cost obtaining submodule; the optimal merge mode determining submodule is configured to determine the left merge mode as the optimal merge mode, and C0 is updated to C3
  • the second determining sub-module is configured to determine whether C0 is less than a preset third threshold, and if C0 is less than the third threshold, triggering the first rate distortion cost determining sub-module; if C0 is not smaller than the third a threshold, the second rate distortion cost obtaining submodule is triggered; the first rate distortion cost determining submodule is configured to determine that the first rate distortion cost C1 of the CTU is equal to C3 in the optimal merge mode, wherein
  • the third threshold is a value smaller than the second threshold; the second rate distortion cost obtaining submodule is configured to perform pixel compensation on the CTU in an up merge mode to obtain a fourth rate distortion cost C4;
  • the third determining submodule is configured to
  • the preset second threshold is: a current optimal coding cost of the CTU.
  • the rate-distortion cost obtaining module is specifically configured to: perform pixel on the CTU according to a preset pixel row interval and/or a preset pixel column interval obtained in an EO mode. make up.
  • the apparatus further includes: a second determining module and a third parameter obtaining module; the second determining module is configured to determine whether the CTU is the first CTU in the video frame, if The CTU is the first CTU in the video frame, triggering the third parameter obtaining module; if the CTU is not the first CTU in the video frame, the mode determining module is triggered; a module configured to perform pixel compensation on the CTU in an EO mode and obtain an SAO parameter of the CTU based on an EO mode.
  • the third parameter obtaining module is specifically configured to select some or all EO types from each preset EO type of the EO mode; respectively, perform pixel compensation on the CTU under the selected EO type, Obtaining a rate-distortion cost of the CTU at each selected EO type selected; determining a pixel compensation result corresponding to a rate-distortion cost that minimizes the obtained rate distortion cost as a pixel compensation result of the CTU in the EO mode .
  • the third parameter obtaining module includes: a third rate distortion cost obtaining sub-module, a fourth determining sub-module, a skip sub-module, and a first parameter obtaining sub-module; a submodule configured to perform pixel compensation on the CTU in an EO mode to obtain a fifth rate distortion penalty C5; the fourth determining submodule is configured to determine whether C5 is less than a current optimal coding cost of the CTU, if C5 is not less than the current optimal coding cost of the CTU, triggering the skip submodule; if C5 is less than the current optimal coding cost of the CTU, triggering the first parameter obtaining submodule; the skip submodule And determining to end the SAO mode decision of the CTU, and skipping the SAO mode decision of other CTUs in the video frame where the CTU is located; the first parameter obtaining submodule is set to obtain the SAO parameter of the CTU based on the EO mode. .
  • the second parameter obtaining module includes: a fifth determining submodule, a second parameter obtaining submodule, and a third parameter obtaining submodule; and the fifth determining submodule is configured to determine whether C2 is smaller than C1 If the C2 is less than C1, triggering the second parameter to obtain a submodule; if C2 is not less than C1, triggering the third parameter to obtain a submodule; the second parameter obtaining a submodule, being set to obtain the CTU based on an EO mode
  • the SAO parameter; the third parameter obtaining submodule configured to obtain the SAO parameter of the CTU based on the optimal merge mode.
  • an electronic device in still another aspect of the implementation of the present application, includes a processor and a memory; a memory configured to store a computer program; and a processor configured to execute a program stored on the memory
  • a computer readable storage medium stores instructions that, when run on a computer, cause the computer to perform any of the SAOs described above Mode decision method.
  • an embodiment of the present application further provides a computer program product comprising instructions, when executed on a computer, causing a computer to perform the SAO mode decision method described in any of the above.
  • an SAO mode decision method, apparatus, electronic device, and computer readable storage medium can perform pixel compensation on a CTU in a merge mode, determine an optimal merge mode, and The first rate distortion cost C1 of the CTU in the optimal merge mode, when C1 is less than the preset first threshold, the AO mode can be directly skipped to determine the SAO parameter of the CTU, when C1 is not less than the first threshold, according to the EO mode
  • the second rate distortion cost C2 and C1 obtained by pixel compensation of the CTU determines the SAO parameter of the CTU.
  • the embodiment of the present application can skip the EO mode when the first rate distortion cost C1 satisfies the condition, which can save coding time and improve coding efficiency.
  • 1 is a general frame diagram of a video codec corresponding to the latest video coding standard HEVC;
  • FIG. 2 is a diagram of an interface frame of the SAO encoding end in the latest video coding standard HEVC;
  • FIG. 3 is a frame diagram of an interface interface of the SAO decoding end in the latest video coding standard HEVC;
  • FIG. 4 is a schematic diagram of four different sets of adjacent pixels of the EO mode in the SAO of the latest video coding standard HEVC;
  • FIG. 5 is a schematic diagram of a merge mode in the SAO in the latest video coding standard HEVC
  • FIG. 6 is a schematic flow chart of a SAO mode decision method
  • FIG. 7 is a schematic diagram of a first process of a method for determining a SAO mode according to an embodiment of the present disclosure
  • FIG. 8 is a schematic flowchart of a second method for determining a SAO mode according to an embodiment of the present disclosure
  • FIG. 9 is a schematic diagram of a third process of a method for determining a SAO mode according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic flowchart of obtaining an SAO parameter of a CTU in an EO mode according to an embodiment of the present disclosure
  • FIG. 11 is a schematic flowchart of determining an SAO parameter of a CTU according to C2 and C1 according to an embodiment of the present disclosure
  • FIG. 12 is a schematic diagram of a first structure of an SAO mode decision apparatus according to an embodiment of the present disclosure.
  • FIG. 13 is a schematic diagram of a second structure of an SAO mode decision apparatus according to an embodiment of the present disclosure.
  • FIG. 14 is a schematic diagram of a third structure of an SAO mode decision apparatus according to an embodiment of the present application.
  • FIG. 15 is a schematic structural diagram of a third parameter obtaining module according to an embodiment of the present disclosure.
  • FIG. 16 is a schematic structural diagram of a second parameter obtaining module according to an embodiment of the present disclosure.
  • FIG. 17 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • FIG. 1 is a general frame diagram of a video codec corresponding to the latest HEVC.
  • the input video signal is processed by a block structure, prediction, transform, quantization, entropy coding, and the like, and finally outputs a bit stream.
  • a video encoder divides a video frame into blocks for encoding.
  • the H.264/AVC (Advanced Video Coding) video coding standard divides a video frame into 16 ⁇ 16 macros that are not covered by each other.
  • Block Micro Block, MB
  • HEVC Enanced Video Coding
  • the size of the CTU can be set in the encoder configuration file, usually 64 ⁇ 64.
  • the quadtree the CTU can be divided into Coding Units (CUs) of different sizes and encoded in units of CU. Then, the CU is divided into different prediction units (PUs), and the prediction is performed in units of PUs to obtain a prediction block.
  • CUs Coding Units
  • PUs prediction units
  • the prediction block is compared with the original PU to obtain a prediction residual block, and the prediction residual block is transformed.
  • a one-dimensional array is formed by a specific scanning method, the array is input to the quantizer for scalar quantization, and the quantized coefficient is input to the entropy encoder for encoding, and the encoded bit stream is output.
  • the encoded video reconstruction block is used as a reference block for subsequent video blocks so that subsequent video blocks can obtain more accurate prediction blocks with inter/intra prediction.
  • Deblocking filtering, SAO, etc. can effectively reduce the distortion of the reconstructed block and improve the subjective/objective quality of the encoded video.
  • FIG. 2 is a frame diagram of the SAO encoding end interface in the latest video coding standard HEVC.
  • the input is video frame block data (ie, original video data) and deblock filtered data, and the output is the final reconstructed block data.
  • video frame block data ie, original video data
  • deblock filtered data ie, deblock filtered data
  • the output is the final reconstructed block data.
  • SAO parameters ie, sample adaptive compensation parameters, offset values, etc., which need to be encoded by an entropy encoder into a code stream input to the decoding end
  • Encoding SAO parameters also requires a certain coded bit.
  • FIG. 3 is a frame diagram of the SAO decoding end interface in the latest video coding standard HEVC, and the input is the deblock filtered data of the reconstructed block data and the SAO information decoded by the entropy decoder. The output is the final reconstructed signal (input to the reference frame list buffer for subsequent video frame reference). Therefore, the SAO needs to weigh the final compressed video quality and compression performance to select the appropriate SAO parameters.
  • the SAO parameter selection process is also called the SAO mode decision process.
  • the SAO parameters mainly include the SAO type, the offset value set, and the merge mode.
  • SAO There are three types of SAO, namely skip mode, EO mode, and BO mode.
  • the offset value set is a set of offset values calculated according to the relationship between the current pixel in the luma coding tree block or the chroma coding tree block and the value of the corresponding pixel in the original image in the EO/BO mode.
  • the calculated offset value is applied to the corresponding pixel to implement pixel compensation of the luma coding tree block or the chroma coding tree block, that is, to reduce the distortion of the reconstructed block.
  • the value of sao_type_idx can be used to identify the SAO type
  • Table 1 is the correspondence between the value of sao_type_idx and the SAO type.
  • the EO mode is a process of calculating an offset value according to a relationship between a current pixel and a neighboring pixel in a luma coding tree block or a chroma coding tree block, and applying the calculated offset value to the current pixel, and the specific operation thereof
  • the method is as follows: According to Table 2, the current pixel can be divided into five different types. In Table 2, the category number of the current pixel is the correspondence between the current pixel and its neighboring pixel relationship.
  • FIG. 4 is a schematic diagram of four different adjacent pixels of the EO mode in the SAO of the latest video coding standard HEVC.
  • a, b represents an adjacent pixel
  • c represents a current pixel. If the "other cases" in Table 2 are satisfied, that is, the pixel belongs to the 0th category, the offset value is not applied to the current pixel c of the category; if the other four cases are satisfied, the current pixel of each category is c assigns an offset value to the current pixel c.
  • the offset value is a positive integer
  • the offset value is a negative integer to avoid encoding bits due to the encoded symbol bits. increase.
  • the specific operation mode of the offset value calculation is as follows: calculating the average value R 1 of all the pixels in each category after the luminance coding tree block or the chroma coding tree block is divided into five categories before the SAO mode decision, and the original image After the pixels of the luma coding tree block or the chroma coding tree block are divided into five categories, the average value S 1 of all the pixels in each category, the offset value of the category is (S 1 - R 1 ).
  • the offset values of each category constitute a set of offset values for the EO mode.
  • the BO mode classifies all pixels according to the value of all the pixels in the luma coding tree block or the chroma coding tree block, and sets an offset value for each type of pixel, and then applies the offset value to the corresponding class.
  • the process on the pixel The specific operation manner is as follows: all pixels are divided into 32 bands that are not inter-interleaved, that is, each band contains pixels corresponding to 8 pixel values, similar to a statistical histogram.
  • the first band contains the value of the pixel, the range belongs to the pixel of [0,7], the second band contains the value of the pixel, the range belongs to the pixel of [8,15], and so on, the 32nd band contains the value of the pixel.
  • the corresponding offset value is determined for the band, and the offset value is applied to the pixels belonging to the band.
  • the offset value is calculated as follows: calculating the average value R 2 of all the pixels in each band after dividing the luminance coding tree block or the chroma coding tree block into 32 bands before the SAO mode decision, and the brightness of the original image
  • the pixel of the coding tree block or the chroma coding tree block is divided into 32 bands, the average value S 2 of all the pixels in each band, and the offset value of the band is (S 2 - R 2 ).
  • the offset value of each band constitutes a set of offset values for the BO mode.
  • FIG. 5 is a schematic diagram of a merge mode in the SAO in the latest video coding standard HEVC.
  • the merge mode (including the up merge mode and the left merge mode) refers to the SAO parameter of the CTU pointed by the current CTU using the arrow.
  • the merge mode is upward, that is, the current CTU uses the SAO parameter of the CTU above the current CTU; the merge mode to the left, that is, the SAO parameter of the current CTU using the CTU of the left CTU
  • a CTU usually includes a luma coding tree block and several chroma coding tree blocks. Therefore, for the SAO mode decision of the CTU, the SAO mode decision needs to be performed separately for the luma coding tree block and the chroma coding tree block.
  • FIG. 6 is a schematic flowchart of a SAO mode decision method.
  • the SAO type decision is made for the CTU.
  • determining the SAO type of the luma coding tree block that is, selecting the one with the lowest rate distortion cost from the three SAO types, to generate the SAO parameter of the luma coding block, and calculating the ratio of the corresponding luma coding block. Distortion cost.
  • the SAO parameters including distortion, offset value, SAO type, etc.
  • the chroma coding tree block may be generated in the same manner, and if the CTU has multiple chroma components, it is required.
  • the rate distortion cost that is, the coding cost, is a measure of the coding performance based on the rate distortion theory in video coding.
  • the rate distortion cost of the CTU after using the SAO i.e., the sum of the rate distortion cost of the luma coding tree block and the rate distortion cost of the chroma coding tree block
  • J1 the rate distortion cost of the CTU after using the SAO
  • the current SAO parameter including the SAO of the luma coding tree block
  • set J0 equal to J1; otherwise, go directly to the next step.
  • the CTU is selected for the SAO merge mode.
  • the rate distortion cost J2 of the CTU in the left merge mode and the rate distortion penalty J3 of the CTU in the up merge mode are sequentially calculated. If the rate distortion cost of the CTU obtained in the current step is less than the current J0, the SAO parameter of the CTU is updated to the corresponding merge mode (ie, the merge mode or the merge mode to the left), and J0 is set equal to the corresponding rate distortion cost (ie, J2 or J3).
  • the rate distortion cost obtained in each step is not less than J0 of the current step, and the SAO mode decision is skipped for the CTU.
  • FIG. 7 is a schematic diagram of a first process of a method for determining an SAO mode according to an embodiment of the present disclosure.
  • the method may be applied to an electronic device, where the electronic device may be used to perform a SAO mode decision on a video image, for example, the electronic device may be a video.
  • An encoder or a device having video encoding capability, the method may include the following steps:
  • S701 Perform pixel compensation on the CTU in the merge mode to determine an optimal merge mode and a first rate distortion cost C1 of the CTU in the optimal merge mode.
  • the merge mode may include a left merge mode and an upward merge mode.
  • the electronic device can perform pixel compensation on the current CTU in the left merge mode and the upward merge mode, respectively, and obtain the rate distortion cost of the current CTU in the left merge mode and the rate distortion cost of the current CTU in the up merge mode, and compare the two different merges.
  • the size of the current CTU rate distortion cost in the mode, the merge mode that determines the rate distortion cost is the merge mode to be selected (ie, the optimal merge mode), and the electronic device can rate the current CTU rate distortion in the optimal merge mode. , as the first rate distortion cost C1.
  • the CTUs mentioned in the following embodiments all represent the luma coding tree block and the chroma coding tree block they contain.
  • the processing of the CTU mentioned refers to corresponding processing of the luma coding tree block included in the CTU, and corresponding processing of the chroma coding tree block included in the CTU.
  • the rate-distortion penalty of the mentioned CTUs represents the sum of the rate-distortion cost of the luma coding tree block included in the CTU and the rate-distortion penalty of the chroma coding tree block included in the CTU.
  • S702 Determine whether C1 is less than a preset first threshold. If C1 is less than the first threshold, perform S703. If C1 is not less than the first threshold, perform S704.
  • the first threshold may be set by a technician according to experience, or may be an optimal coding cost of the current CTU before the SAO mode decision is made.
  • S703 Obtain a SAO parameter of the CTU based on the optimal merge mode.
  • the electronic device may determine the merge mode of the current CTU. (ie, the optimal merge mode), skip the SAO type decision step, and obtain the SAO parameter of the current CTU according to the optimal merge mode (up merge mode or left merge mode) (the SAO parameter of the CTU above the current CTU or the current CTU left) The SAO parameter of the square CTU).
  • the optimal merge mode up merge mode or left merge mode
  • the SAO parameter may include a SAO type and an offset value set of the CTU above the current CTU or an SAO type and an offset value set of the current CTU left CTU.
  • the electronic device may perform pixel compensation on the current CTU by using each EO type of the EO mode, and calculate a current CTU that performs pixel compensation on the current CTU by using each EO type.
  • Each rate distortion cost The electronic device can use the smallest rate distortion cost among the calculated rate distortion costs as the second rate distortion cost.
  • S705 Determine the SAO parameter of the CTU according to C2 and C1.
  • the electronic device may determine the SAO parameter of the current CTU according to C2 and C1. When it is determined that C2 is less than C1, the electronic device may obtain the SAO parameter of the current CTU based on the EO mode; when it is determined that C2 is greater than or equal to C1, the electronic device may obtain the SAO parameter of the current CTU based on the optimal merge mode corresponding to C1.
  • the electronic device may skip the EO mode decision step and directly obtain the SAO parameter of the current CTU based on the optimal merge mode, thereby saving The coding time increases the coding efficiency.
  • FIG. 8 is a schematic flowchart of a second method for determining a SAO mode according to an embodiment of the present application, where pixel compensation is performed on a CTU in a merge mode to determine an optimal merge.
  • the mode and the first rate distortion cost C1 of the CTU in the optimal merge mode (S701) may include the following steps:
  • S7011 Set the target threshold C0 to a preset second threshold.
  • the second threshold is a value greater than the first threshold.
  • the second threshold may be an optimal coding cost before the current CTU does not perform the SAO mode decision.
  • C0 is a numerically variable amount in the merge mode selection process, and the electronic device can set the initial value of C0 to be equal to the preset second threshold.
  • S7012 Perform pixel compensation on the CTU in the left merge mode to obtain a third rate distortion penalty C3.
  • the electronic device may acquire the SAO type (EO mode or BO mode or skip mode) of the current CTU left CTU and the offset value set (the skip mode does not have the offset value set), and according to the obtained
  • the SAO type and the offset value set perform pixel compensation on the current CTU, and then the electronic device can calculate the rate distortion cost C3 of the current CTU under the obtained SAO type and the offset value set according to the compensation result.
  • the method for performing pixel compensation on the current CTU by the electronic device according to the SAO type and the offset value set may refer to the specific operation steps of the above-mentioned electronic device for performing pixel compensation on the current CTU in the EO mode and the BO mode. Narration.
  • S7013 It is judged whether C3 is smaller than C0. If C3 is smaller than C0, S7014 is executed; if C3 is not smaller than C0, S7015 is executed.
  • the electronic device can determine whether the rate distortion cost C3 obtained by the current CTU in the left merge mode is smaller than the optimal coding cost C0 of the current CTU.
  • the electronic device may determine that the current CTU selects the left merge mode (optimal merge mode) and sets the value of C0. Updated to the value of the third rate distortion penalty C3.
  • S7015 Perform pixel compensation on the CTU in the up merge mode to obtain a fourth rate distortion penalty C4.
  • the value of C0 at this time is equal to the second threshold or C3.
  • the electronic device may acquire the SAO type (EO mode or BO mode or skip mode) and the offset value set of the CTU above the current CTU, and perform pixel compensation on the current CTU according to the obtained SAO type and the offset value set. Then, the electronic device can calculate the rate distortion cost C4 of the current CTU under the obtained SAO type and the offset value according to the compensation result.
  • SAO type EO mode or BO mode or skip mode
  • S7016 Determine whether C0 is less than a preset third threshold. If C0 is less than the third threshold, perform S7017; if C0 is not less than the third threshold, execute S7015.
  • the third threshold is a value smaller than the second threshold.
  • the electronic device determines that the third rate distortion cost C3 is less than C0, and the value of C0 at this time is equal to the third rate distortion cost C3.
  • the electronic device determines whether C3 is less than a preset third threshold.
  • S7017 Determine that the first rate distortion cost C1 of the CTU in the optimal merge mode is equal to C3.
  • the value of C0 at this time is equal to the third rate distortion penalty C3, and the electronic device may skip the selection process of the upward merge mode, determine that the optimal merge mode of the current CTU is the left merge mode, and determine the first of the current CTU.
  • the rate distortion penalty C1 is equal to the third rate distortion penalty C3 of the current CTU in the left merge mode.
  • S7018 It is judged whether C4 is smaller than C0. If C4 is smaller than C0, S7019 is executed; if C4 is not smaller than C0, S7020 is executed.
  • S7019 Determine the up merge mode as the optimal merge mode, and the first rate distortion cost C1 of the CTU in the optimal merge mode is equal to the fourth rate distortion cost C4.
  • S7020 Determine that the first rate distortion cost C1 of the CTU in the optimal merge mode is equal to C0.
  • the electronic device may determine whether the rate distortion cost C4 obtained by the current CTU in the up merge mode is smaller than the current C0 (equal to the second threshold or the third rate distortion penalty C3).
  • the electronic device may determine that the current CTU selects the up merge mode (optimal merge mode), and determines the first rate distortion cost C1 of the current CTU, Equal to the rate distortion cost C4 of the current CTU in the up merge mode.
  • the electronic device may determine that the first rate distortion penalty C1 is equal to C0.
  • the optimal merge mode is determined according to the value of the current C0. If C0 is currently the third rate distortion cost C3, the optimal merge mode is the left merge mode. If C0 is currently the second threshold, the electronic device skips the merge for the current CTU. Mode processing.
  • the electronic device may determine that the first rate distortion cost C1 of the current CTU is equal to C3 in the optimal merge mode, that is, Directly skipping the selection process of the up merge mode can save coding time and improve coding efficiency.
  • the second threshold is the current optimal coding cost of the current CTU, that is, the optimal coding cost before the CTU is not subjected to the SAO mode decision.
  • the electronic device may set the second threshold to the current optimal coding cost of the current CTU, as the threshold value initially determined in the merge mode selection process, and the threshold value can be used to accurately merge the mode. The choice to improve coding efficiency.
  • performing pixel compensation on the CTU in the EO mode may include:
  • the CTU is pixel compensated according to a preset set of pixel rows and/or a preset pixel column interval.
  • the electronic device may sample the pixels within the luma coding tree block and/or the chroma coding block in an interlaced manner. Among the sampled pixels, for pixels belonging to the same category, the electronic device can calculate an offset value of the pixel of the category.
  • the electronic device when sampling the pixels in the luma coding tree block and/or the chroma coding block, if the sampling is performed by one line, the electronic device can reduce the calculation amount by half when calculating the offset value; With three rows of sampling, the electronic device can reduce the calculation by three-quarters when calculating the offset value.
  • the present application does not limit the manner in which the sampling is taken, and the specific interval can be determined by balancing the calculation amount and the encoding cost.
  • the method for calculating the offset value by the electronic device may refer to the specific operation steps of obtaining the offset value set in the EO mode by the foregoing electronic device, and details are not described herein again.
  • the electronic device can calculate the offset value set according to the preset pixel row interval and/or the preset pixel column interval, which can reduce the calculation amount and improve the coding efficiency.
  • FIG. 9 is a third schematic flowchart of a method for determining a SAO mode according to an embodiment of the present application, which may include the following steps:
  • S901 Determine whether the CTU is the first CTU in the video frame. If the CTU is the first CTU in the video frame, perform S902. If the CTU is not the first CTU in the video frame, perform S903.
  • the first CTU in the video frame there is no upper CTU, and there is no left CTU. Therefore, the electronic device does not select the merge mode for the first CTU within the video frame.
  • the SAO mode decision process of the electronic device for the CTU includes only the SAO type decision. In the case where both the EO mode and the BO mode exist, the probability that the electronic device selects the EO mode is great and the EO mode can better reflect the direct relationship of adjacent pixels. Therefore, the BO mode can be directly ignored to reduce the steps of the SAO type decision, thereby reducing the computational cost.
  • S902 Perform pixel compensation on the CTU in the EO mode, and obtain the SAO parameter of the CTU based on the EO mode.
  • the electronic device can skip the merge mode decision process, directly in the EO mode, the first CTU in the video frame. Perform pixel compensation to obtain the parameters of the SAO.
  • the method for performing pixel compensation on the first CTU in the video frame by the electronic device in the EO mode may refer to the specific operation steps of the above-mentioned electronic device for performing pixel compensation on the current CTU in the EO mode.
  • S903 Perform pixel compensation on the CTU in the merge mode to determine an optimal merge mode and a first rate distortion cost C1 of the CTU in the optimal merge mode.
  • S904 Determine whether C1 is less than a preset first threshold. If C1 is less than the first threshold, perform S905. If C1 is not less than the first threshold, perform S906.
  • S905 Obtain a SAO parameter of the CTU based on the optimal merge mode.
  • S906 Perform pixel compensation on the CTU in the EO mode to obtain a second rate distortion penalty C2.
  • S907 Determine the SAO parameter of the CTU according to C2 and C1.
  • S903 is the same as S701, S904 is the same as S702, S905 is the same as S703, S906 is the same as S704, and S907 is the same as S705, and details are not described herein.
  • the electronic device can skip the merge mode decision process, directly perform pixel compensation on the EO mode, and obtain the parameters of the SAO, thereby reducing Calculate the cost and improve coding efficiency.
  • the electronic device performs pixel compensation on the CTU in the EO mode, which may include the following steps:
  • the electronic device may select any one or a combination of the four types as the EO type to be selected. Based on the candidate EO types obtained above, pixel compensation is performed on the current CTU under each candidate EO type, and the rate distortion cost of the current CTU under each candidate EO type can be obtained. The electronic device can determine the candidate EO type with the lowest rate distortion cost as the EO type of the current EO mode, and obtain the pixel compensation result of the current CTU under the candidate EO type with the lowest rate distortion cost.
  • the present application recommends using the first EO type and the second EO type in FIG. 4 as the EO type to be selected, but there is no limitation on the type of EO to be selected, which can be determined by balancing the calculation amount and the coding cost.
  • the type of EO to be selected is not limited.
  • the method for performing pixel compensation on the current CTU by the electronic device in each candidate EO type may refer to the specific operation steps of the above-mentioned electronic device for performing pixel compensation on the current CTU in the EO mode.
  • the electronic device can select some or all of the EO types from the preset EO types in the EO mode as the EO type to be selected, which can reduce the calculation amount of the EO type determining step, thereby improving Coding efficiency.
  • FIG. 10 is a schematic flowchart of obtaining an SAO parameter of a CTU in an EO mode according to an embodiment of the present application, where pixel compensation is performed on a CTU in an EO mode, And obtaining the SAO parameter of the CTU based on the EO mode (S902), which may include the following steps:
  • the first CTU in the video frame there is no upper CTU, and there is no left CTU. Therefore, the electronic device does not select the merge mode for the first CTU within the video frame.
  • the SAO mode decision process of the electronic device for the CTU includes only the SAO type decision. In the case where both the EO mode and the BO mode exist, the probability that the electronic device selects the BO mode is smaller and the EO mode can better reflect the direct relationship of adjacent pixels. Therefore, the electronic device can directly ignore the BO mode and perform pixel compensation on the CTU only in the EO mode to obtain a fifth rate distortion penalty C5.
  • S9022 Determine whether C5 is smaller than a current optimal coding cost of the CTU. If C5 is not less than a current optimal coding cost of the CTU, perform S9023. If C5 is less than a current optimal coding cost of the CTU, perform S9024.
  • S9023 End the SAO mode decision of the CTU, and skip the SAO mode decision of other CTUs in the video frame where the CTU is located.
  • S9024 Obtain the SAO parameter of the CTU based on the EO mode.
  • the electronic device can determine whether C5 is less than the current optimal coding cost of the current CTU. When it is determined that C5 is greater than or equal to the current optimal coding cost of the current CTU, the rate distortion penalty after the SAO mode decision is increased on the CTU, and therefore, the electronic device may determine that the CTU skips the SAO mode decision. When it is determined that C5 is less than the current optimal coding cost of the current CTU, the electronic device may obtain the SAO parameter of the current CTU based on the EO mode.
  • the probability of selecting the merge mode in the SAO mode decision process is extremely large. If all CTUs in the current video frame adopt the merge mode, the first CTU will determine the SAO parameters of all CTUs in the video frame in which it is located. Therefore, if the first CTU skips the SAO mode decision, the electronic device can determine that all CTUs in the video frame in which the first CTU is located skip the SAO mode decision.
  • the electronic device may skip the SAO mode decision of all CTUs in the video frame, and reduce the SAO mode. The amount of calculation in the decision process, which in turn increases the coding efficiency.
  • FIG. 11 is a schematic flowchart of determining a SAO parameter of a CTU according to C2 and C1 according to an embodiment of the present application, where the CAO of the CTU is determined according to C2 and C1.
  • the parameter (S705) may include the following steps:
  • S7051 It is judged whether C2 is smaller than C1, if C2 is smaller than C1, S7052 is executed; if C2 is not smaller than C1, S7053 is executed.
  • S7052 Obtain the SAO parameter of the CTU based on the EO mode.
  • C1 may be equal to the second threshold, or may be equal to C3, and may be equal to C4.
  • the electronic device may determine that the SAO parameter of the current CTU is the SAO parameter obtained based on the EO mode.
  • the electronic device may determine that the SAO parameter of the current CTU is the SAO parameter obtained based on the optimal merge mode.
  • the electronic device may determine that the current CTU is a skip SAO mode decision; when C1 is equal to C3, the electronic device may determine that the current CTU SAO parameter is the SAO parameter obtained in the left merge mode; C1 is equal to At C4, the electronic device can determine that the SAO parameter of the current CTU is the SAO parameter obtained in the up merge mode.
  • the electronic device is based on the size relationship of C2 and C1, and according to the value of C1, the SAO parameter of the current CTU can be directly determined.
  • FIG. 12 is a schematic diagram of a first structure of an SAO mode decision apparatus according to an embodiment of the present disclosure, including: a mode determining module 1201, a first determining module 1202, and a first parameter obtaining module. 1203.
  • the mode determining module 1201 is configured to perform pixel compensation on the coding tree unit CTU in the merge mode, determine an optimal merge mode and a first rate distortion cost C1 of the CTU in the optimal merge mode;
  • the first determining module 1202 is configured to determine whether C1 is less than a preset first threshold, if C1 is less than the first threshold, triggering the first parameter obtaining module 1203; if C1 is not less than the first threshold, the triggering rate distortion obtaining module 1204;
  • the first parameter obtaining module 1203 is configured to obtain a sample adaptive compensation SAO parameter of the CTU based on the optimal merge mode
  • the rate-distortion cost obtaining module 1204 is configured to perform pixel compensation on the CTU in the EO mode to obtain a second rate distortion cost C2;
  • the second parameter obtaining module 1205 is configured to determine the SAO parameter of the CTU according to C2 and C1.
  • the EO mode decision step may be skipped, and the current CTU SAO parameter is directly obtained based on the optimal merge mode, which can save coding. Time to improve coding efficiency.
  • FIG. 13 is a schematic diagram of a second structure of an SAO mode determining apparatus according to an embodiment of the present application, where the mode determining module 1201 includes: a threshold determining sub-module 12011, The first rate distortion obtaining submodule 12012, the first determining submodule 12013, the optimal merge mode determining submodule 12014, the second determining submodule 12015, the first rate distortion cost determining submodule 12016, and the second rate distortion cost obtaining submodule 12017, third judgment sub-module 12018, second rate distortion cost determination sub-module 12019 and third rate distortion cost determination sub-module 12020.
  • the mode determining module 1201 includes: a threshold determining sub-module 12011, The first rate distortion obtaining submodule 12012, the first determining submodule 12013, the optimal merge mode determining submodule 12014, the second determining submodule 12015, the first rate distortion cost determining submodule 12016, and the second rate distortion cost obtaining submodule 12017, third judgment sub-
  • the threshold determining sub-module 12011 is configured to set the target threshold C0 to a preset second threshold, wherein the second threshold is a value greater than the first threshold;
  • the first rate distortion penalty obtaining sub-module 12012 is configured to perform pixel compensation on the CTU in the left merge mode to obtain a third rate distortion penalty C3;
  • the first judging sub-module 12013 is configured to determine whether C3 is less than C0, if C3 is less than C0, trigger the optimal merge mode determining sub-module 12014; if C3 is not less than C0, trigger the second rate-distortion cost obtaining sub-module 12017;
  • the optimal merge mode determining sub-module 12014 is configured to determine the left merge mode as the optimal merge mode, and C0 is updated to C3;
  • the second judging sub-module 12015 is configured to determine whether C0 is less than a preset third threshold. If C0 is less than the third threshold, the first rate distortion cost determination sub-module 12016 is triggered; if C0 is not less than the third threshold, the second rate is triggered. Distortion cost obtained sub-module 12017;
  • a first rate distortion penalty determination sub-module 12016 configured to determine that the first rate distortion cost C1 of the CTU is equal to C3 in the optimal merge mode, wherein the third threshold is a value less than the second threshold;
  • the second rate distortion penalty obtaining sub-module 12017 is set to perform pixel compensation on the CTU in the up merge mode to obtain a fourth rate distortion penalty C4;
  • the third determining sub-module 12018 is configured to determine whether C4 is less than C0, if C4 is less than C0, triggering the second rate distortion cost determination sub-module 12019; if C4 is not less than C0, triggering the third rate distortion cost determining sub-module 12020;
  • the second rate distortion cost determination sub-module 12019 is configured to determine the upward merge mode as the optimal merge mode, and the first rate distortion cost C1 of the CTU is equal to C4 in the optimal merge mode;
  • the third rate distortion penalty determination sub-module 12020 is configured to determine that the first rate distortion penalty C1 of the CTU is equal to C0 in the optimal merge mode.
  • the preset second threshold is: the current optimal coding cost of the CTU.
  • the solution provided by the embodiment of the present application sets the second threshold to the current optimal coding cost of the current CTU, and is used as the threshold value initially determined in the merge mode selection process, and the threshold value can be used to accurately select the merge mode. Improve coding efficiency.
  • the rate-distortion cost obtaining module may also be configured to:
  • the CTU is pixel compensated according to a preset set of pixel rows and/or a preset pixel column interval.
  • the solution provided by the embodiment of the present application calculates the offset value set according to the preset pixel row interval and/or the preset pixel column interval, which can reduce the calculation amount and improve the coding efficiency.
  • FIG. 14 is a schematic diagram of a third structure of an SAO mode determining apparatus according to an embodiment of the present disclosure.
  • the apparatus may further include: a second determining module 1206 and a third parameter obtaining module. 1207;
  • the second determining module 1206 is configured to determine whether the CTU is the first CTU in the video frame, and if the CTU is the first CTU in the video frame, triggering the third parameter obtaining module 1207; if the CTU is not in the video frame First CTU, trigger mode determination module 1201;
  • the third parameter obtaining module 1207 is configured to perform pixel compensation on the CTU in the EO mode, and obtain the SAO parameter of the CTU based on the EO mode.
  • the merge mode decision process can be skipped, and the pixel compensation is performed directly in the EO mode to obtain the parameters of the SAO, thereby reducing the computational cost and improving the coding efficiency.
  • the third parameter obtaining module 1207 may be further configured to select some or all of the EO types from each preset EO type of the EO mode;
  • the pixel compensation result corresponding to the rate distortion cost of the obtained rate distortion cost is determined as the pixel compensation result of the CTU in the EO mode.
  • the solution provided by the embodiment of the present application can select some or all of the EO types from the preset EO types of the EO mode as the EO type to be selected, which can reduce the calculation amount of the EO type determining step, thereby improving the coding efficiency. .
  • FIG. 15 is a schematic structural diagram of a third parameter obtaining module according to an embodiment of the present application, where the third parameter obtaining module 1207 includes: a third rate distortion cost.
  • the sub-module 12071, the fourth judging sub-module 12072, the skip sub-module 12073, and the first parameter obtaining sub-module 1274 are obtained.
  • the third rate distortion cost obtaining sub-module 12071 is configured to perform pixel compensation on the CTU in the EO mode to obtain a fifth rate distortion cost C5;
  • the fourth judging sub-module 12072 is configured to determine whether the C5 is less than the current optimal coding cost of the CTU, and if the C5 is not less than the current optimal coding cost of the CTU, the trigger skip module 12073 is triggered; if C5 is less than the current optimal coding cost of the CTU , triggering the first parameter obtaining submodule 1274;
  • Skip sub-module 12073 set to end the CAO SAO mode decision, and skip the SAO mode decision of other CTUs in the video frame where the CTU is located;
  • the first parameter obtaining sub-module 1274 is set to obtain the SAO parameter of the CTU based on the EO mode.
  • the solution provided by the embodiment of the present application skips the SAO mode decision of all CTUs in the video frame when determining the first CTU in the video frame to skip the SAO mode decision, and reduces the calculation of the SAO mode decision process. Quantity, which in turn improves coding efficiency.
  • FIG. 16 is a schematic structural diagram of a second parameter obtaining module according to an embodiment of the present application, where the second parameter obtaining module 1205 includes: a fifth determining submodule 12051, a second parameter obtaining submodule 12052 and a third parameter obtaining submodule 12053;
  • the fifth determining sub-module 12051 is configured to determine whether C2 is less than C1, if C2 is less than C1, triggering the second parameter obtaining sub-module 12052; if C2 is not less than C1, triggering the third parameter obtaining sub-module 12053;
  • a second parameter obtaining submodule 12052 configured to obtain a SAO parameter of the CTU based on the EO mode
  • the third parameter obtaining sub-module 12053 is configured to obtain the SAO parameter of the CTU based on the optimal merge mode.
  • the embodiment of the present application further provides an electronic device, as shown in FIG. 17, including a processor 1701 and a memory 1702;
  • a memory 1701 configured to store a computer program
  • the processor 1702 when configured to execute the program stored on the memory 1701, implements the SAO mode decision method provided by the embodiment of the present application.
  • the above SAO mode decision method may include:
  • the SAO parameters of the CTU are determined.
  • the memory mentioned in the above electronic device may include a random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage.
  • the memory may also be at least one storage device located away from the aforementioned processor.
  • the above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (Network Processor, NP for short), or a digital signal processor (DSP). , Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component.
  • CPU central processing unit
  • NP Network Processor
  • DSP digital signal processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • the electronic device provided by the embodiment of the present application can skip the EO mode when the first rate distortion cost C1 satisfies the condition in the SAO mode decision process, which can save coding time and improve coding efficiency.
  • the embodiment of the present application further provides a computer readable storage medium, where the computer readable storage medium stores instructions, and when executed on a computer, causes the computer to execute the SAO mode decision method provided by the embodiment of the present application.
  • the above SAO mode decision method may include:
  • the SAO parameters of the CTU are determined.
  • the EO mode can be skipped when the first rate distortion cost C1 satisfies the condition, which can save coding time and improve coding efficiency.
  • the embodiment of the present application further provides a computer program product including instructions, which when executed on a computer, causes the computer to execute the SAO mode decision method provided by the embodiment of the present application.
  • the above SAO mode decision method may include:
  • the SAO parameters of the CTU are determined.
  • the EO mode can be skipped when the first rate distortion cost C1 satisfies the condition, which can save coding time and improve coding efficiency.
  • the computer program product includes one or more computer instructions.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be from a website site, computer, server or data center Transfer to another website site, computer, server, or data center by wire (eg, coaxial cable, fiber optic, digital subscriber line (DSL), or wireless (eg, infrared, wireless, microwave, etc.).
  • the computer readable storage medium can be any available media that can be accessed by a computer or a data storage device such as a server, data center, or the like that includes one or more available media.
  • the usable medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
  • the CTU may be compensated in the merge mode to determine the optimal merge mode and the first rate distortion cost C1 of the CTU in the optimal merge mode, when C1 is less than the preset number
  • the AO mode can be directly skipped to determine the SAO parameter of the CTU.
  • the SAO of the CTU is determined according to the second rate distortion cost C2 and C1 obtained by performing pixel compensation on the CTU in the EO mode. parameter. In this way, the embodiment of the present application can skip the EO mode when the first rate distortion cost C1 satisfies the condition, which can save coding time and improve coding efficiency.

Landscapes

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

Abstract

一种SAO模式决策方法、装置、电子设备及可读存储介质,上述方法包括:在合并模式下对编码树单元CTU进行像素补偿,确定最优合并模式及在最优合并模式下CTU的第一率失真代价C1,在C1小于预设的第一阈值的情况下,基于最优合并模式获得CTU的样本自适应补偿SAO参数,在C1不小于第一阈值的情况下,在EO模式下对CTU进行像素补偿,获得第二率失真代价C2,根据C2和C1,确定CTU的SAO参数,进而完成CTU的SAO模式决策。应用本申请实施例的SAO模式决策方法,能够提高编码效率。

Description

SAO模式决策方法、装置、电子设备及可读存储介质
本申请要求于2017年11月01日提交中国专利局、申请号为201711058757.6发明名称为“SAO模式决策方法、装置、电子设备及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及视频编码技术领域,特别是涉及一种SAO模式决策方法、装置、电子设备及计算机可读存储介质。
背景技术
SAO(Sample Adaptive Offset,样本自适应补偿)是在高效率视频编码标准(High Efficiency Video Coding,HEVC)中提出的一种新型的环内滤波技术,其目的是在尽可能地降低压缩性能的前提下,增加像素补偿而减少原始图像与重构图像之间的失真,从而提升压缩后视频的视觉质量。
为了获得更好的编码性能,在视频编码过程中需要选择合适的SAO参数,SAO参数的选择过程又称SAO模式决策过程。SAO参数主要包括:SAO类型、偏移值集合和合并模式,其中,SAO类型包括:跳过模式、EO(Edge Offset,边缘补偿)模式和BO(Band Offset,带状补偿)模式。
由于一个CTU(Coding Tree Unit,编码树单元)包括一个亮度编码树块和若干个色度编码树块,因此,现有技术中基于CTU的SAO模式决策需要对CTU中的亮度编码树块和色度编码树块分别做SAO模式决策,具体过程如下:
首先,分别在跳过模式、EO模式和BO模式三种模式下对亮度编码树块和色度编码树块进行像素补偿,得到上述三种模式下CTU的最小的率失真代价,记为J1,若J1小于CTU的最佳编码代价J0,则设置J0等于J1,生成CTU的SAO参数。然后,在合并模式下分别对亮度编码树块和色度编码树块进行像素补偿,得到CTU的率失真代价,记为J2,若J2小于J0,则设置J0等于J2,并更新CTU的SAO参数。
由上述可以看出,现有技术中进行SAO模式决策时过程复杂,增加了编码时间,导致编码效率不高。
发明内容
本申请提供了一种SAO模式决策方法、装置、电子设备及计算机可读存储介质,以提高编码效率。具体技术方案如下:
第一方面,为了达到上述目的,本申请实施例公开了一种SAO模式决策方法,所述方法包括:在合并模式下对编码树单元CTU进行像素补偿,确定最优合并模式及在所述最优合并模式下所述CTU的第一率失真代价C1;在C1小于预设的第一阈值的情况下,基于所述最优合并模式获得所述CTU的样本自适应补偿SAO参数;在C1不小于所述第一阈值的情况下,在EO模式下对所述CTU进行像素补偿,获得第二率失真代价C2;根据C2和C1,确定所述CTU的SAO参数。
在一实施方式中,所述在合并模式下对编码树单元CTU进行像素补偿,确定最优合并模式及在所述最优合并模式下所述CTU的第一率失真代价C1,包括:将目标阈值C0设置为预设的第二阈值,其中,所述第二阈值为大于所述第一阈值的值;在向左合并模式下对所述CTU进行像素补偿,获得第三率失真代价C3;在C3不小于C0的情况下,在向上合并模式下对所述CTU进行像素补偿,获得第四率失真代价C4;在C3小于C0的情况下,将向左合并模式确定为最优合并模式,C0更新为C3;在C0小于预设的第三阈值的情况下,确定在所述最优合并模式下所述CTU的第一率失真代价C1等于C3,其中,所述第三阈值为小于所述第二阈值的值;在C0不小于所述第三阈值的情况下,在向上合并模式下对所述CTU进行像素补偿,获得第四率失真代价C4;在C4小于C0的情况下,将向上合并模式确定为最优合并模式,且在所述最优合并模式下所述CTU的第一率失真代价C1等于C4;在C4不小于C0的情况下,确定在最优合并模式下所述CTU的第一率失真代价C1等于C0。
在一实施方式中,所述预设的第二阈值为:所述CTU的当前最佳编码代价。
在一实施方式中,所述在EO模式下对所述CTU进行像素补偿,包括:在EO模式下,按照预设的像素行间隔和/或预设的像素列间隔得到的偏移值集合对所述CTU进行像素补偿。
在一实施方式中,在所述在合并模式下对编码树单元CTU进行像素补偿,确定最优合并模式及在所述最优合并模式下所述CTU的第一率失真代价C1之前,还包括:判断所述CTU是否为所在视频帧中的第一个CTU;如果所述CTU 是所在视频帧中的第一个CTU,在EO模式下对所述CTU进行像素补偿,并基于EO模式获得所述CTU的SAO参数;所述在合并模式下对编码树单元CTU进行像素补偿,确定最优合并模式及在所述最优合并模式下所述CTU的第一率失真代价C1,包括:如果所述CTU不是所在视频帧中的第一个CTU,在合并模式下对CTU进行像素补偿,确定最优合并模式及在所述最优合并模式下所述CTU的第一率失真代价C1。
在一实施方式中,所述在EO模式下对所述CTU进行像素补偿,包括:从EO模式的各个预设EO类型中选择部分或者全部EO类型;分别在所选择的EO类型下对所述CTU进行像素补偿,获得所述CTU在所选择的各所选择的EO类型下的率失真代价;将所获得率失真代价中取值最小的率失真代价对应的像素补偿结果确定为EO模式下所述CTU的像素补偿结果。
在一实施方式中,所述在EO模式下对所述CTU进行像素补偿,并基于EO模式获得所述CTU的SAO参数,包括:在EO模式下对所述CTU进行像素补偿,获得第五率失真代价C5;判断C5是否小于所述CTU的当前最佳编码代价;如果C5不小于所述CTU的当前最佳编码代价,结束所述CTU的SAO模式决策,并跳过所述CTU所在视频帧中其他CTU的SAO模式决策;如果C5小于所述CTU的当前最佳编码代价,基于EO模式获得所述CTU的SAO参数。
在一实施方式中,所述根据C2和C1,确定所述CTU的SAO参数,包括:若C2小于C1,基于EO模式获得所述CTU的SAO参数;若C2不小于C1,基于所述最优合并模式获得所述CTU的SAO参数。
第二方面,为了达到上述目的,本申请实施例还公开了一种SAO模式决策装置,所述装置包括:模式确定模块,设置为在合并模式下对CTU进行像素补偿,确定最优合并模式及在所述最优合并模式下所述CTU的第一率失真代价C1;第一判断模块,设置为判断C1是否小于预设的第一阈值,如果C1小于所述第一阈值,触发第一参数获得模块;如果C1不小于所述第一阈值,触发率失真代价获得模块;所述第一参数获得模块,设置为基于所述最优合并模式获得所述CTU的SAO参数;所述率失真代价获得模块,设置为在EO模式下对所述CTU进行像素补偿,获得第二率失真代价C2;第二参数获得模块,设置为根据C2和C1,确定所述CTU的SAO参数。
在一实施方式中,所述模式确定模块包括:阈值确定子模块、第一率失真代价获得子模块、第一判断子模块、最优合并模式确定子模块、第二判断 子模块、第一率失真代价确定子模块、第二率失真代价获得子模块、第三判断子模块、第二率失真代价确定子模块和第三率失真代价确定子模块;所述阈值确定子模块,设置为将目标阈值C0设置为预设的第二阈值,其中,所述第二阈值为大于所述第一阈值的值;所述第一率失真代价获得子模块,设置为在向左合并模式下对所述CTU进行像素补偿,获得第三率失真代价C3;所述第一判断子模块,设置为判断C3是否小于C0,如果C3小于C0,触发所述最优合并模式确定子模块;如果C3不小于C0,触发所述第二率失真代价获得子模块;所述最优合并模式确定子模块,设置为将向左合并模式确定为最优合并模式,C0更新为C3;所述第二判断子模块,设置为判断C0是否小于预设的第三阈值,如果C0小于所述第三阈值,触发所述第一率失真代价确定子模块;如果C0不小于所述第三阈值,触发所述第二率失真代价获得子模块;所述第一率失真代价确定子模块,设置为确定在所述最优合并模式下所述CTU的第一率失真代价C1等于C3,其中,所述第三阈值为小于所述第二阈值的值;所述第二率失真代价获得子模块,设置为在向上合并模式下对所述CTU进行像素补偿,获得第四率失真代价C4;所述第三判断子模块,设置为判断C4是否小于C0,如果C4小于C0,触发所述第二率失真代价确定子模块;如果C4不小于C0,触发所述第三率失真代价确定子模块;所述第二率失真代价确定子模块,设置为将向上合并模式确定为最优合并模式,且在所述最优合并模式下所述CTU的第一率失真代价C1等于C4;所述第三率失真代价确定子模块,设置为确定在最优合并模式下所述CTU的第一率失真代价C1等于C0。
在一实施方式中,所述预设的第二阈值为:所述CTU的当前最佳编码代价。
在一实施方式中,所述率失真代价获得模块具体设置为:在EO模式下,按照预设的像素行间隔和/或预设的像素列间隔得到的偏移值集合对所述CTU进行像素补偿。
在一实施方式中,所述装置还包括:第二判断模块和第三参数获得模块;所述第二判断模块,设置为判断所述CTU是否为所在视频帧中的第一个CTU,如果所述CTU是所在视频帧中的第一个CTU,触发所述第三参数获得模块;如果所述CTU不是所在视频帧中的第一个CTU,触发所述模式确定模块;所述第三参数获得模块,设置为在EO模式下对所述CTU进行像素补偿,并基于 EO模式获得所述CTU的SAO参数。
在一实施方式中,所述第三参数获得模块,具体设置为从EO模式的各个预设EO类型中选择部分或者全部EO类型;分别在所选择的EO类型下对所述CTU进行像素补偿,获得所述CTU在所选择的各所选择的EO类型下的率失真代价;将所获得率失真代价中取值最小的率失真代价对应的像素补偿结果确定为EO模式下所述CTU的像素补偿结果。
在一实施方式中,所述第三参数获得模块包括:第三率失真代价获得子模块、第四判断子模块、跳过子模块和第一参数获得子模块;所述第三率失真代价获得子模块,设置为在EO模式下对所述CTU进行像素补偿,获得第五率失真代价C5;所述第四判断子模块,设置为判断C5是否小于所述CTU的当前最佳编码代价,如果C5不小于所述CTU的当前最佳编码代价,触发所述跳过子模块;如果C5小于所述CTU的当前最佳编码代价,触发所述第一参数获得子模块;所述跳过子模块,设置为结束所述CTU的SAO模式决策,并跳过所述CTU所在视频帧中其他CTU的SAO模式决策;所述第一参数获得子模块,设置为基于EO模式获得所述CTU的SAO参数。
在一实施方式中,所述第二参数获得模块包括:第五判断子模块、第二参数获得子模块和第三参数获得子模块;所述第五判断子模块,设置为判断C2是否小于C1,如果C2小于C1,触发所述第二参数获得子模块;如果C2不小于C1,触发所述第三参数获得子模块;所述第二参数获得子模块,设置为基于EO模式获得所述CTU的SAO参数;所述第三参数获得子模块,设置为基于所述最优合并模式获得所述CTU的SAO参数。
在本申请实施的又一方面,还提供了一种电子设备,所述电子设备包括处理器和存储器;存储器,设置为存放计算机程序;处理器,设置为执行存储器上所存放的程序时,实现上述任一所述的SAO模式决策方法。
在本申请实施的又一方面,还提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述任一所述的SAO模式决策方法。
在本申请实施的又一方面,本申请实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述任一所述的SAO模式决策方法。
由上述的技术方案可见,本申请实施例提供的一种SAO模式决策方法、 装置、电子设备及计算机可读存储介质,可以在合并模式下对CTU进行像素补偿,确定最优合并模式及在最优合并模式下CTU的第一率失真代价C1,当C1小于预设的第一阈值时,可以直接跳过EO模式确定CTU的SAO参数,当C1不小于第一阈值时,根据在EO模式下对CTU进行像素补偿获得的第二率失真代价C2和C1,确定CTU的SAO参数。这样,应用本申请实施例可以在第一率失真代价C1满足条件时跳过EO模式,能节省编码时间,提高编码效率。
当然,实施本申请的任一产品或方法并不一定需要同时达到以上所述的所有优点。
附图说明
为了更清楚地说明本申请实施例和现有技术的技术方案,下面对实施例和现有技术中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为最新的视频编码标准HEVC对应的视频编解码器总体框架图;
图2为最新的视频编码标准HEVC内SAO编码端接口框架图;
图3为最新的视频编码标准HEVC内SAO解码端接口框架图;
图4为最新的视频编码标准HEVC内SAO中EO模式的四组不同的相邻像素示意图;
图5为最新的视频编码标准HEVC内SAO中的合并模式示意图;
图6为SAO模式决策方法的一种流程示意图;
图7为本申请实施例提供的SAO模式决策方法的第一种流程示意图;
图8为本申请实施例提供的SAO模式决策方法的第二种流程示意图;
图9为本申请实施例提供的SAO模式决策方法的第三种流程示意图;
图10为本申请实施例提供的在EO模式下获得CTU的SAO参数的一种流程示意图;
图11为本申请实施例提供的根据C2和C1确定CTU的SAO参数的一种流程示意图;
图12为本申请实施例提供的SAO模式决策装置的第一种结构示意图;
图13为本申请实施例提供的SAO模式决策装置的第二种结构示意图;
图14为本申请实施例提供的SAO模式决策装置的第三种结构示意图;
图15为本申请实施例提供的第三参数获得模块的一种结构示意图;
图16为本申请实施例提供的第二参数获得模块的一种结构示意图;
图17为本申请实施例提供的电子设备的一种结构示意图。
具体实施方式
为使本申请的目的、技术方案、及优点更加清楚明白,以下参照附图并举实施例,对本申请进一步详细说明。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
首先结合现有技术中样本自适应补偿SAO模式决策方法介绍本申请涉及到的技术名词。
视频压缩,也称视频编码,其目的是消除视频图像间存在的冗余信息。至今,国内外标准化组织已相继制定了多种不同的视频编码标准,主流的视频编码标准均采用“基于块的预测和变换”的混合编码框架。参见图1,图1为最新的HEVC对应的视频编解码器总体框架图,输入的视频信号经过块结构划分、预测、变换、量化、熵编码等编码技术处理后,最后输出比特流。
一般情况下,视频编码器将视频帧划分为块进行编码,如H.264/AVC(Advanced Video Coding,高级视频编码)视频编码标准将视频帧划分为等大小互不覆盖的16×16的宏块(Macro Block,MB),而HEVC则将视频帧划分成均匀等大小的编码树单元(Coding Tree Unit,CTU),CTU的大小可以在编码器配置文件中设置,通常采用64×64大小。按照四叉树的方式又可以将CTU划分为不同大小的编码单元(Coding Unit,CU),以CU为单位进行编码。再以CU为基准划分成不同的预测单元(Prediction Unit,PU),以PU为单位进行预测,得到预测块,预测块与原始PU做差可以得到预测残差块,预测残差块再经过变换后得到变换系数块,后经特定的扫描方式形成一维的数组,将数组输入量化器进行标量量化,将量化后的系数输入熵编码器进行编码,输出编码比特流。已编码的视频重构块会作为后续视频块的参考块,以便后续视频块以帧间/帧内预测能够得到更为准确的预测块。而原始视频块与经过预测、变换、量化、反量化、反变换后得到的重构块之间可能存在一定的误差,即得到的重构块存在失真。而去块滤波、SAO等能有效地降低重构块的 失真、进而提升编码后视频的主观/客观质量。
参见图2,图2为最新的视频编码标准HEVC内SAO编码端接口框架图,输入为视频帧块数据(即原始视频数据)和经去块滤波后的数据,输出为最终的重构块数据(即重构视频数据,可用作参考块供后续编码块编码)和SAO参数(即样本自适应补偿参数、偏移值等,需经熵编码器编码成码流输入至解码端),而编码SAO参数也需要一定的编码比特。
对于解码器来说,参见图3,图3为最新的视频编码标准HEVC内SAO解码端接口框架图,输入为重构块数据经去块滤波后的数据以及熵解码器解码得到的SAO信息,输出为最终的重构信号(输入至参考帧列表缓冲区以备后续视频帧参考)。因此,SAO需权衡最终压缩后视频质量与压缩性能选择合适的SAO参数,SAO参数的选择过程又称SAO模式决策过程。
SAO参数主要包括SAO类型、偏移值集合和合并模式。SAO类型包括三种,即跳过模式、EO模式和BO模式。偏移值集合即在EO/BO模式下,根据亮度编码树块或色度编码树块内当前像素与原始图像中对应像素的值的关系计算得到的一组偏移值的集合。把计算得到的偏移值作用于相应的像素,以实现亮度编码树块或色度编码树块的像素补偿,也即降低重构块的失真。例如,可以用sao_type_idx的值来标识SAO类型,表1为sao_type_idx的值与SAO类型的对应关系。
表1
sao_type_idx SAO类型
0 跳过模式
1 BO模式
2 EO模式
其中,EO模式是根据亮度编码树块或色度编码树块内当前像素与其相邻像素之间的关系计算偏移值,并把计算得到的偏移值作用于当前像素的过程,其具体操作方式如下:根据表2可以将当前像素分成五种不同的类型,表2中为当前像素的类别编号,与当前像素和其相邻像素关系之间的对应关系。
表2
类别编号 条件
1 c<a&&c<b
2 (c<a&&c==b)||(c==a&&c<b)
3 (c>a&&c==b)||(c==a&&c>b)
4 c>a&&c>b
0 其它情况
参见图4,图4为最新的视频编码标准HEVC内SAO中EO模式的四组不同的相邻像素示意图。a、b表示相邻像素,c表示当前像素。若满足表2中的“其它情况”,即该像素属于第0类别,则不会把偏移值作用于该类别的当前像素c;若满足其余四种情况,则为每一类别的当前像素c分配一个偏移值,加到当前像素c中。对于第1类别和第2类别的当前像素,其偏移值为正整数,对于第3类别和第4类别的当前像素,其偏移值为负整数,以避免由于编码符号位导致编码比特的增加。其中,偏移值计算的具体操作方式如下:计算亮度编码树块或色度编码树块进行SAO模式决策前划分成5个类别后,每一个类别中所有像素的平均值R 1,以及原始图像的亮度编码树块或色度编码树块的像素划分成5个类别后,每一个类别中所有像素的平均值S 1,该类别的偏移值即为(S 1-R 1)。各类别的偏移值构成了EO模式的偏移值集合。
BO模式是根据亮度编码树块或色度编码树块内所有的像素的值大小,对所有像素进行分类,并对每一类的像素设置偏移值,然后将偏移值作用于对应类的像素上的过程。具体操作方式如下:将所有的像素分为32个不相互交织的带(band),即每个带包含对应的8个像素值的像素,类似统计直方图。第1个带包含像素的值的范围属于[0,7]的像素,第2个带包含像素的值的范围属于[8,15]的像素,依此类推,第32个带包含像素的值的范围属于[248,255]的像素。针对每个带,确定该带相应的偏移值,把偏移值作用于属于该带的像素上。
选择CTU内像素分布最集中的4个带,并传输这4个带的起始位置以及相应的偏移值至解码端。其中,偏移值的计算方式如下:计算亮度编码树块或色度编码树块进行SAO模式决策前划分成32个带后,每一个带中所有像素的平均值R 2,以及原始图像的亮度编码树块或色度编码树块的像素划分成32个带后,每一个带中所有像素的平均值S 2,该带的偏移值即为(S 2-R 2)。各带的偏移值构成了BO模式的偏移值集合。
参见图5,图5为最新的视频编码标准HEVC内SAO中的合并模式示意图。如图5所示,合并模式(包括向上合并模式和向左合并模式)是指当前CTU使用箭头所指向的CTU的SAO参数。向上合并模式,即当前CTU使用当前CTU上方CTU的SAO参数;向左合并模式,即当前CTU使用当前CTU 左方CTU的SAO参数
一个CTU通常包括一个亮度编码树块和若干个色度编码树块,因此,对CTU进行SAO模式决策,需要对亮度编码树块和色度编码树块分别进行SAO模式决策。
参照图6,图6为SAO模式决策方法的一种流程示意图。
首先,对CTU进行SAO类型决策。第一步,确定亮度编码树块的SAO类型,也即从三种SAO类型中选择率失真代价最小的一种,以生成该亮度编码块的SAO参数,并计算得到相应的亮度编码块的率失真代价。第二步,如果CTU存在色度分量,则可以按照同样的方式生成色度编码树块的SAO参数(包括失真、偏移值、SAO类型等),且若CTU存在多个色度分量则需要对多个色度编码树块分别进行模式决策,生成相应的SAO参数(包括失真、偏移值、SAO类型等),并计算得到相应的色度编码块的率失真代价。率失真代价,即编码代价,是视频编码中以率失真理论为基础来评价编码性能的一种衡量指标。
然后,计算使用SAO后CTU的率失真代价(即亮度编码树块的率失真代价和色度编码树块的率失真代价之和)J1。此时,如果亮度编码树块和色度编码树块中有一个不采用跳过模式,且J1小于使用SAO前CTU最佳编码代价J0,则需存储当前SAO参数(包括亮度编码树块的SAO类型、偏移值集合和色度编码树块的SAO类型、偏移值集合),并设置J0等于J1;否则,直接进入下一步。
再次,对CTU进行SAO合并模式的选择。按照向左合并模式、向上合并模式,依次计算得到向左合并模式下的CTU的率失真代价J2,以及向上合并模式下的CTU的率失真代价J3。若当前步骤得到的CTU的率失真代价小于当前J0,则将CTU的SAO参数更新为相应的合并模式(即向上合并或者向左合并模式),并设置J0等于相应的率失真代价(即J2或J3)。
最终,若经过SAO类型决策得到的J1不小于J0,且进行SAO合并模式选择过程中,每一步骤得到的率失真代价都不小于当前步骤的J0,设置对该CTU跳过SAO模式决策。
由上述可以看出,SAO模式决策过程复杂,增加了编码时间和计算量,编码效率不高。
下面再通过具体实施例对本申请的SAO模式决策方法进行详细介绍。
图7为本申请实施例提供的SAO模式决策方法的第一种流程示意图,该方法可以应用于电子设备,该电子设备可以用于对视频图像进行SAO模式决策,例如,该电子设备可以为视频编码器或具有视频编码功能的设备,该方法可以包括以下步骤:
S701:在合并模式下对CTU进行像素补偿,确定最优合并模式及在最优合并模式下CTU的第一率失真代价C1。
本实施例中,合并模式可以包括向左合并模式和向上合并模式。
电子设备可以分别在向左合并模式和向上合并模式下对当前CTU进行像素补偿,得到向左合并模式下当前CTU的率失真代价和向上合并模式下当前CTU的率失真代价,比较两种不同合并模式下当前CTU的率失真代价的大小,确定率失真代价较小的合并模式为要选择的合并模式(即最优合并模式),电子设备可以将最优合并模式下的当前CTU的率失真代价,作为第一率失真代价C1。
需要注意的是,依据现有技术中SAO模式决策方法的介绍,可以得知,对CTU进行像素补偿,也即是对CTU包含的亮度编码树块和色度编码树块进行像素补偿。同理,下面实施例中提到的CTU均表示其包含的亮度编码树块和色度编码树块。提到的对CTU进行处理均表示对CTU包含的亮度编码树块进行相应的处理、并对CTU包含的色度编码树块进行相应的处理。提到的CTU的率失真代价均表示CTU包含的亮度编码树块的率失真代价与CTU包含的色度编码树块的率失真代价之和。
S702:判断C1是否小于预设的第一阈值,如果C1小于第一阈值,执行S703;如果C1不小于第一阈值,执行S704。
其中,第一阈值可以是技术人员根据经验设定的,也可以是进行SAO模式决策前当前CTU的最佳编码代价。
S703:基于最优合并模式获得CTU的SAO参数。
经过大量实验发现,SAO模式决策过程中,最终选择合并模式的概率极大,因此,在本实施例中,当判定C1小于预设的第一阈值时,电子设备可以在确定当前CTU的合并模式(即最优合并模式)后,跳过SAO类型决策步骤,并根据最优合并模式(向上合并模式或向左合并模式)获得当前CTU的SAO参数(当前CTU上方CTU的SAO参数或当前CTU左方CTU的SAO参数)。
其中,SAO参数可以包含当前CTU上方CTU的SAO类型和偏移值集合或当前CTU左方CTU的SAO类型和偏移值集合。
S704:在EO模式下对CTU进行像素补偿,获得第二率失真代价C2。
本实施例中,当判定C1大于或者等于第一阈值时,电子设备可以利用EO模式的各EO类型分别对当前CTU进行像素补偿,并计算利用各EO类型对当前CTU进行像素补偿的当前CTU的各率失真代价。电子设备可以将计算得到的各率失真代价中最小的率失真代价,作为第二率失真代价。
S705:根据C2和C1,确定CTU的SAO参数。
本实施例中,电子设备可以根据C2和C1,确定当前CTU的SAO参数。当判定C2小于C1时,电子设备可以基于EO模式获得当前CTU的SAO参数;当判定C2大于或者等于C1时,电子设备可以基于C1对应的最优合并模式获得当前CTU的SAO参数。
由上述可见,本申请实施例提供的方案,在C1小于预设的第一阈值的情况下,电子设备可以跳过EO模式决策步骤,直接基于最优合并模式获得当前CTU的SAO参数,能够节省编码的时间,提高编码效率。
在本申请的一个具体实施例中,参见图8,图8为本申请实施例提供的SAO模式决策方法的第二种流程示意图,其中,在合并模式下对CTU进行像素补偿,确定最优合并模式及在最优合并模式下CTU的第一率失真代价C1(S701),可以包括以下步骤:
S7011:将目标阈值C0设置为预设的第二阈值。
其中,第二阈值为大于第一阈值的值。
一种实现方式中,第二阈值可以为当前CTU未进行SAO模式决策前的最佳编码代价。C0为进行合并模式选择过程中的一个数值可变的量,电子设备可以设置C0的最初值等于预设的第二阈值。
S7012:在向左合并模式下对CTU进行像素补偿,获得第三率失真代价C3。
本实施例中,电子设备可以获取当前CTU左方CTU的SAO类型(EO模式或BO模式或跳过模式)和偏移值集合(跳过模式则不存在偏移值集合),并根据获得的SAO类型和偏移值集合对当前CTU进行像素补偿,然后,电子设备可以根据补偿结果,计算当前CTU在获得的SAO类型和偏移值集合作用下的率失真代价C3。
本步骤中,电子设备根据SAO类型和偏移值集合对当前CTU进行像素补偿的方法,可以参考上述电子设备在EO模式和BO模式下对当前CTU进行像素补偿的具体操作步骤,此处不再赘述。
S7013:判断C3是否小于C0,如果C3小于C0,执行S7014;如果C3不小于C0,执行S7015。
S7014:将向左合并模式确定为最优合并模式,C0更新为C3。
本实施例中,电子设备可以判断当前CTU在向左合并模式下得到的率失真代价C3,是否小于当前CTU的最佳编码代价C0。当判定当前CTU在向左合并模式下得到的率失真代价C3小于当前CTU的最佳编码代价C0时,电子设备可以确定当前CTU选择向左合并模式(最优合并模式),并将C0的值更新为第三率失真代价C3的值。
S7015:在向上合并模式下对CTU进行像素补偿,获得第四率失真代价C4。
根据S7015,此时的C0的值等于第二阈值或C3。
本实施例中,电子设备可以获取当前CTU上方CTU的SAO类型(EO模式或BO模式或跳过模式)和偏移值集合,并根据获得的SAO类型和偏移值集合对当前CTU进行像素补偿,然后,电子设备可以根据补偿结果,计算当前CTU在获得的SAO类型和偏移值作用下的率失真代价C4。
S7016:判断C0是否小于预设的第三阈值,如果C0小于第三阈值,执行S7017;如果C0不小于第三阈值,执行S7015。
其中,第三阈值为小于第二阈值的值。
S7013中,电子设备判定第三率失真代价C3小于C0,此时的C0的值等于第三率失真代价C3。
因此,本步骤中,即电子设备判断C3是否小于预设的第三阈值。
S7017:确定在最优合并模式下CTU的第一率失真代价C1等于C3。
根据S7016,此时的C0的值等于第三率失真代价C3,电子设备可以跳过向上合并模式的选择过程,确定当前CTU的最优合并模式为向左合并模式,并确定当前CTU的第一率失真代价C1,等于当前CTU在向左合并模式下的第三率失真代价C3。
S7018:判断C4是否小于C0,如果C4小于C0,执行S7019;如果C4不小于C0,执行S7020。
S7019:将向上合并模式确定为最优合并模式,且在最优合并模式下CTU的第一率失真代价C1等于第四率失真代价C4。
S7020:确定在最优合并模式下CTU的第一率失真代价C1等于C0。
本实施例中,电子设备可以判断当前CTU在向上合并模式下得到的率失真代价C4,是否小于当前的C0(等于第二阈值或第三率失真代价C3)。当判定当前CTU在向上合并模式下得到的率失真代价C4小于当前的C0时,电子设备可以确定当前CTU选择向上合并模式(最优合并模式),并确定当前CTU的第一率失真代价C1,等于当前CTU在向上合并模式下的率失真代价C4。当判定当前CTU在向上合并模式下得到的率失真代价C4大于或者等于当前的C0时,电子设备可以确定第一率失真代价C1等于C0。最优合并模式根据当前C0的值确定,如果C0当前为第三率失真代价C3,则最优合并模式为向左合并模式,如果C0当前为第二阈值,则电子设备对当前CTU跳过合并模式处理。
由上述可见,本申请实施例提供的方案,在C0小于预设的第三阈值的情况下,电子设备可以确定在最优合并模式下当前CTU的第一率失真代价C1等于C3,也即可直接跳过向上合并模式的选择过程,能够节省编码的时间,提高编码效率。
在本申请的一个具体实施例中,第二阈值为当前CTU的当前最佳编码代价,即CTU未进行SAO模式决策前的最佳编码代价。
由上述可见,本申请实施例提供的方案,电子设备可以将第二阈值设置为当前CTU的当前最佳编码代价,作为合并模式选择过程中最初判断的阈值,利用该阈值能够准确地进行合并模式的选择,提高编码效率。
在本申请的一个具体实施例中,在EO模式下对CTU进行像素补偿,可以包括:
在EO模式下,按照预设的像素行间隔和/或预设的像素列间隔得到的偏移值集合对CTU进行像素补偿。
一种实现方式中,在计算偏移值集合时,电子设备可以以隔行的方式对亮度编码树块和/或色度编码数块内的像素进行采样。在采样得到的像素中,针对属于同一类别的像素,电子设备可以计算该类别像素的偏移值。
其中,对亮度编码树块和/或色度编码数块内的像素进行采样时,若采取隔一行进行采样的方式,则电子设备在计算偏移值时可以减少一半的计算量; 若采取隔三行进行采样的方式,则电子设备在计算偏移值时可以减少四分之三的计算量。本申请对于采样时采取的间隔方式并不进行限制,可通过权衡计算量和编码代价来确定具体的间隔方式。
本步骤中,电子设备计算偏移值的方法,可以参照上述电子设备在EO模式下获得偏移值集合的具体操作步骤,此处不再赘述。
由上述可见,本申请实施例提供的方案,电子设备可以按照预设的像素行间隔和/或预设的像素列间隔来计算偏移值集合,能够减少计算量,提高编码效率。
在本申请的一个具体实施例中,参见图9,图9为本申请实施例提供的SAO模式决策方法的第三种流程示意图,可以包括以下步骤:
S901:判断CTU是否为所在视频帧中的第一个CTU,如果CTU是所在视频帧中的第一个CTU,执行S902;如果CTU不是所在视频帧中的第一个CTU,执行S903。
视频帧内的第一个CTU,不存在上方CTU,也不存在左方CTU。因此,针对视频帧内的第一个CTU,电子设备不会选择合并模式。电子设备对该CTU的SAO模式决策过程只包括SAO类型的决策。而在EO模式和BO模式均存在的情况下,电子设备选择EO模式的概率极大且EO模式更能反映相邻像素直接的关系。因此,可以直接忽略BO模式以减少SAO类型的决策的步骤,从而减少计算代价。
S902:在EO模式下对CTU进行像素补偿,并基于EO模式获得CTU的SAO参数。
本实施例中,对于视频帧中的第一个CTU,由于电子设备不会选择合并模式,因此,电子可以跳过合并模式决策过程,直接在EO模式下对该视频帧中的第一个CTU进行像素补偿,获得SAO的参数。
其中,电子设备在EO模式下对视频帧中的第一个CTU进行像素补偿的方法,可以参照上述电子设备在EO模式下对当前CTU进行像素补偿的具体操作步骤。
S903:在合并模式下对CTU进行像素补偿,确定最优合并模式及在最优合并模式下CTU的第一率失真代价C1。
S904:判断C1是否小于预设的第一阈值,如果C1小于第一阈值,执行S905;如果C1不小于第一阈值,执行S906。
S905:基于最优合并模式获得CTU的SAO参数。
S906:在EO模式下对CTU进行像素补偿,获得第二率失真代价C2。
S907:根据C2和C1,确定CTU的SAO参数。
其中,S903与S701相同,S904与S702相同,S905与S703相同,S906与S704相同,S907与S705一致,在此不再赘述。
由上述可见,本申请实施例提供的方案,对于视频帧中的第一个CTU,电子设备可以跳过合并模式决策过程,直接在EO模式下对其进行像素补偿,获得SAO的参数,从而减少计算代价,提高编码效率。
在本申请的一个具体实施例中,电子设备在EO模式下对CTU进行像素补偿,可以包括以下步骤:
从EO模式的各个预设EO类型中选择部分或者全部EO类型,分别在所选择的EO类型下对CTU进行像素补偿,获得CTU在所选择的各所选择的EO类型下的率失真代价,将所获得率失真代价中取值最小的率失真代价对应的像素补偿结果确定为EO模式下CTU的像素补偿结果。
基于现有技术的介绍可以得知,EO模式的EO类型中包含四种类型。一种实现方式中,电子设备可以从四种类型中选择任意一种或几种的组合作为待选的EO类型。基于上述得到的待选的EO类型,分别在各待选的EO类型下对当前CTU进行像素补偿,可以获得在各待选的EO类型下当前CTU的率失真代价。电子设备可以将率失真代价最小的待选的EO类型,确定为当前EO模式的EO类型,并获得在率失真代价最小的待选的EO类型下,当前CTU的像素补偿结果。
其中,本申请推荐使用图4中的第一种EO类型和第二种EO类型作为待选的EO类型,但对于待选的EO类型并不进行限制,可通过权衡计算量和编码代价来确定待选的EO类型。
本步骤中,电子设备在各待选的EO类型下对当前CTU进行像素补偿的方法,可以参照上述电子设备在EO模式下对当前CTU进行像素补偿的具体操作步骤。
由上述可见,本申请实施例提供的方案,电子设备可以从EO模式的各个预设EO类型中选择部分或者全部EO类型作为待选的EO类型,能够减少EO类型确定步骤的计算量,进而提高编码效率。
在本申请的一个具体实施例中,参见图10,图10为本申请实施例提供的 在EO模式下获得CTU的SAO参数的一种流程示意图,其中,在EO模式下对CTU进行像素补偿,并基于EO模式获得CTU的SAO参数(S902),可以包括以下步骤:
S9021:在EO模式下对CTU进行像素补偿,获得第五率失真代价C5。
视频帧内的第一个CTU,不存在上方CTU,也不存在左方CTU。因此,针对视频帧内的第一个CTU,电子设备不会选择合并模式。电子设备对该CTU的SAO模式决策过程只包括SAO类型的决策。而在EO模式和BO模式均存在的情况下,电子设备选择BO模式的概率更小且EO模式更能反映相邻像素直接的关系。因此,电子设备可以直接忽略BO模式,仅在EO模式下对该CTU进行像素补偿,获得第五率失真代价C5。
S9022:判断C5是否小于CTU的当前最佳编码代价,如果C5不小于CTU的当前最佳编码代价,执行S9023;如果C5小于CTU的当前最佳编码代价,执行S9024。
S9023:结束CTU的SAO模式决策,并跳过CTU所在视频帧中其他CTU的SAO模式决策。
S9024:基于EO模式获得CTU的SAO参数。
本实施例中,电子设备可以判断C5是否小于当前CTU的当前最佳编码代价。当判定C5大于或者等于当前CTU的当前最佳编码代价时,即对该CTU进行SAO模式决策后的率失真代价反而增大,因此,电子设备可以确定该CTU跳过SAO模式决策。当判定C5小于当前CTU的当前最佳编码代价时,电子设备可以基于EO模式获得当前CTU的SAO参数。
而SAO模式决策过程选择合并模式的概率极大,若当前视频帧中所有CTU都采用合并模式,则第一个CTU将决定其所在视频帧中所有CTU的SAO参数。因此,若第一个CTU跳过SAO模式决策,则电子设备可以确定该第一个CTU所在视频帧中所有CTU都跳过SAO模式决策。
由上述可见,本申请实施例提供的方案,如果电子设备确定视频帧中的第一个CTU跳过SAO模式决策,则电子设备可以跳过该视频帧中所有CTU的SAO模式决策,减少SAO模式决策过程的计算量,进而提高编码效率。
在本申请的一个具体实施例中,参见图11,图11为本申请实施例提供的根据C2和C1,确定CTU的SAO参数的一种流程示意图,其中,根据C2和C1,确定CTU的SAO参数(S705),可以包括以下步骤:
S7051:判断C2是否小于C1,如果C2小于C1,执行S7052;如果C2不小于C1,执行S7053。
S7052:基于EO模式获得CTU的SAO参数。
S7053:基于最优合并模式获得CTU的SAO参数。
此时的C1可能等于第二阈值,也有可能等于C3,还有可能等于C4。
若C2小于C1,也即合并模式获得的最优合并模式下的率失真代价大于EO模式下的率失真代价,电子设备可以确定当前CTU的SAO参数为基于EO模式获得的SAO参数。
若C2不小于C1,也即合并模式获得的最优合并模式下的率失真代价小于EO模式下的率失真代价,电子设备可以确定当前CTU的SAO参数为基于最优合并模式获得的SAO参数。
其中,C1等于第二阈值时,电子设备可以确定当前CTU为跳过SAO模式决策;C1等于C3时,电子设备可以确定当前CTU的SAO参数为在向左合并模式下获得的SAO参数;C1等于C4时,电子设备可以确定当前CTU的SAO参数为在向上合并模式下获得的SAO参数。
由上述可见,本申请实施例提供的方案,电子设备基于C2和C1的大小关系,并根据C1的值,可以直接确定出当前CTU的SAO参数。
与上述方法实施例相对应,参见图12,图12为本申请实施例提供的SAO模式决策装置的第一种结构示意图,包括:模式确定模块1201、第一判断模块1202、第一参数获得模块1203、率失真代价获得模块1204和第二参数获得模块1205。
模式确定模块1201,设置为在合并模式下对编码树单元CTU进行像素补偿,确定最优合并模式及在最优合并模式下CTU的第一率失真代价C1;
第一判断模块1202,设置为判断C1是否小于预设的第一阈值,如果C1小于第一阈值,触发第一参数获得模块1203;如果C1不小于第一阈值,触发率失真代价获得模块1204;
第一参数获得模块1203,设置为基于最优合并模式获得CTU的样本自适应补偿SAO参数;
率失真代价获得模块1204,设置为在EO模式下对CTU进行像素补偿,获得第二率失真代价C2;
第二参数获得模块1205,设置为根据C2和C1,确定CTU的SAO参数。
由上述可见,本申请实施例提供的方案,在C1小于预设的第一阈值的情况下,可以跳过EO模式决策步骤,直接基于最优合并模式获得当前CTU的SAO参数,能够节省编码的时间,提高编码效率。
在本申请的一个具体实施例中,参见图13,图13为本申请实施例提供的SAO模式决策装置的第二种结构示意图,其中,模式确定模块1201,包括:阈值确定子模块12011、第一率失真代价获得子模块12012、第一判断子模块12013、最优合并模式确定子模块12014、第二判断子模块12015、第一率失真代价确定子模块12016、第二率失真代价获得子模块12017、第三判断子模块12018、第二率失真代价确定子模块12019和第三率失真代价确定子模块12020。
阈值确定子模块12011,设置为将目标阈值C0设置为预设的第二阈值,其中,第二阈值为大于第一阈值的值;
第一率失真代价获得子模块12012,设置为在向左合并模式下对CTU进行像素补偿,获得第三率失真代价C3;
第一判断子模块12013,设置为判断C3是否小于C0,如果C3小于C0,触发最优合并模式确定子模块12014;如果C3不小于C0,触发第二率失真代价获得子模块12017;
最优合并模式确定子模块12014,设置为将向左合并模式确定为最优合并模式,C0更新为C3;
第二判断子模块12015,设置为判断C0是否小于预设的第三阈值,如果C0小于第三阈值,触发第一率失真代价确定子模块12016;如果C0不小于第三阈值,触发第二率失真代价获得子模块12017;
第一率失真代价确定子模块12016,设置为确定在最优合并模式下CTU的第一率失真代价C1等于C3,其中,第三阈值为小于第二阈值的值;
第二率失真代价获得子模块12017,设置为在向上合并模式下对CTU进行像素补偿,获得第四率失真代价C4;
第三判断子模块12018,设置为判断C4是否小于C0,如果C4小于C0,触发第二率失真代价确定子模块12019;如果C4不小于C0,触发第三率失真代价确定子模块12020;
第二率失真代价确定子模块12019,设置为将向上合并模式确定为最优合并模式,且在最优合并模式下CTU的第一率失真代价C1等于C4;
第三率失真代价确定子模块12020,设置为确定在最优合并模式下CTU的第一率失真代价C1等于C0。
由上述可见,本申请实施例提供的方案,在C0小于预设的第三阈值的情况下,确定在最优合并模式下CTU的第一率失真代价C1等于C3,也即可直接跳过向上合并模式的选择过程,能够节省编码的时间,提高编码效率。
在本申请的一个具体实施例中,预设的第二阈值为:CTU的当前最佳编码代价。
由上述可见,本申请实施例提供的方案,把第二阈值设置为当前CTU的当前最佳编码代价,作为合并模式选择过程中最初判断的阈值,利用该阈值能够准确地进行合并模式的选择,提高编码效率。
在本申请的一个具体实施例中,率失真代价获得模块还可设置为:
在EO模式下,按照预设的像素行间隔和/或预设的像素列间隔得到的偏移值集合对CTU进行像素补偿。
由上述可见,本申请实施例提供的方案,按照预设的像素行间隔和/或预设的像素列间隔来计算偏移值集合,能够减少计算量,提高编码效率。
在本申请的一个具体实施例中,参见图14,图14为本申请实施例提供的SAO模式决策装置的第三种结构示意图,装置还可以包括:第二判断模块1206和第三参数获得模块1207;
第二判断模块1206,设置为判断CTU是否为所在视频帧中的第一个CTU,如果CTU是所在视频帧中的第一个CTU,触发第三参数获得模块1207;如果CTU不是所在视频帧中的第一个CTU,触发模式确定模块1201;
第三参数获得模块1207,设置为在EO模式下对CTU进行像素补偿,并基于EO模式获得CTU的SAO参数。
对于视频帧中的第一个CTU,可以跳过合并模式决策过程,直接在EO模式下对其进行像素补偿,获得SAO的参数,从而减少计算代价,提高编码效率。
在本申请的一个具体实施例中,第三参数获得模块1207,还可以设置为从EO模式的各个预设EO类型中选择部分或者全部EO类型;
分别在所选择的EO类型下对CTU进行像素补偿,获得CTU在所选择的各所选择的EO类型下的率失真代价;
将所获得率失真代价中取值最小的率失真代价对应的像素补偿结果确定 为EO模式下CTU的像素补偿结果。
由上述可见,本申请实施例提供的方案,可以从EO模式的各个预设EO类型中选择部分或者全部EO类型作为待选的EO类型,能够减少EO类型确定步骤的计算量,进而提高编码效率。
在本申请的一个具体实施例中,参见图15,图15为本申请实施例提供的第三参数获得模块的一种结构示意图,其中,第三参数获得模块1207,包括:第三率失真代价获得子模块12071、第四判断子模块12072、跳过子模块12073和第一参数获得子模块12074。
第三率失真代价获得子模块12071,设置为在EO模式下对CTU进行像素补偿,获得第五率失真代价C5;
第四判断子模块12072,设置为判断C5是否小于CTU的当前最佳编码代价,如果C5不小于CTU的当前最佳编码代价,触发跳过子模块12073;如果C5小于CTU的当前最佳编码代价,触发第一参数获得子模块12074;
跳过子模块12073,设置为结束CTU的SAO模式决策,并跳过CTU所在视频帧中其他CTU的SAO模式决策;
第一参数获得子模块12074,设置为基于EO模式获得CTU的SAO参数。
由上述可见,本申请实施例提供的方案,在确定视频帧中的第一个CTU为跳过SAO模式决策时,则跳过视频帧中所有CTU的SAO模式决策,减少SAO模式决策过程的计算量,进而提高编码效率。
在本申请的一个具体实施例中,参见图16,图16为本申请实施例提供的第二参数获得模块的一种结构示意图,其中,第二参数获得模块1205,包括:第五判断子模块12051、第二参数获得子模块12052和第三参数获得子模块12053;
第五判断子模块12051,设置为判断C2是否小于C1,如果C2小于C1,触发第二参数获得子模块12052;如果C2不小于C1,触发第三参数获得子模块12053;
第二参数获得子模块12052,设置为基于EO模式获得CTU的SAO参数;
第三参数获得子模块12053,设置为基于最优合并模式获得CTU的SAO参数。
由上述可见,本申请实施例提供的方案,基于C2和C1的大小关系,并根据C1的值可以直接确定出CTU的SAO参数。
本申请实施例还提供了一种电子设备,如图17所示,包括处理器1701和存储器1702;
存储器1701,设置为存放计算机程序;
处理器1702,设置为执行存储器1701上所存放的程序时,实现本申请实施例提供的SAO模式决策方法。
上述SAO模式决策方法,可以包括:
在合并模式下对CTU进行像素补偿,确定最优合并模式及在最优合并模式下CTU的第一率失真代价C1;
在C1小于预设的第一阈值的情况下,基于最优合并模式获得CTU的SAO参数;
在C1不小于第一阈值的情况下,在EO模式下对CTU进行像素补偿,获得第二率失真代价C2;
根据C2和C1,确定CTU的SAO参数。
需要说明的是,上述SAO模式决策方法的其他实现方式与前述方法实施例部分相同,这里不再赘述。
上述电子设备提到的存储器可以包括随机存取存储器(Random Access Memory,简称RAM),也可以包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。
上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(Digital Signal Processing,简称DSP)、专用集成电路(Application Specific Integrated Circuit,简称ASIC)、现场可编程门阵列(Field-Programmable Gate Array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。
本申请实施例提供的电子设备,在进行SAO模式决策过程中,可以在第一率失真代价C1满足条件时跳过EO模式,能节省编码时间,提高编码效率。
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行本申请实施例提供的SAO模式决策方法。
上述SAO模式决策方法,可以包括:
在合并模式下对CTU进行像素补偿,确定最优合并模式及在最优合并模式下CTU的第一率失真代价C1;
在C1小于预设的第一阈值的情况下,基于最优合并模式获得CTU的SAO参数;
在C1不小于第一阈值的情况下,在EO模式下对CTU进行像素补偿,获得第二率失真代价C2;
根据C2和C1,确定CTU的SAO参数。
需要说明的是,上述SAO模式决策方法的其他实现方式与前述方法实施例部分相同,这里不再赘述。
通过运行本申请实施例提供的计算机可读存储介质中存储的指令,在进行SAO模式决策过程中,可以在第一率失真代价C1满足条件时跳过EO模式,能节省编码时间,提高编码效率。
本申请实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行本申请实施例提供的SAO模式决策方法。
上述SAO模式决策方法,可以包括:
在合并模式下对CTU进行像素补偿,确定最优合并模式及在最优合并模式下CTU的第一率失真代价C1;
在C1小于预设的第一阈值的情况下,基于最优合并模式获得CTU的SAO参数;
在C1不小于第一阈值的情况下,在EO模式下对CTU进行像素补偿,获得第二率失真代价C2;
根据C2和C1,确定CTU的SAO参数。
需要说明的是,上述SAO模式决策方法的其他实现方式与前述方法实施例部分相同,这里不再赘述。
通过运行本申请实施例提供的计算机程序产品,在进行SAO模式决策过程中,可以在第一率失真代价C1满足条件时跳过EO模式,能节省编码时间,提高编码效率。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的 流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置、电子设备、计算机可读存储介质、计算机程序产品实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。
工业实用性
基于本申请实施例提供的上述技术方案,可以在合并模式下对CTU进行像素补偿,确定最优合并模式及在最优合并模式下CTU的第一率失真代价C1,当C1小于预设的第一阈值时,可以直接跳过EO模式确定CTU的SAO 参数,当C1不小于第一阈值时,根据在EO模式下对CTU进行像素补偿获得的第二率失真代价C2和C1,确定CTU的SAO参数。这样,应用本申请实施例可以在第一率失真代价C1满足条件时跳过EO模式,能节省编码时间,提高编码效率。

Claims (18)

  1. 一种样本自适应补偿SAO模式决策方法,所述方法包括:
    在合并模式下对编码树单元CTU进行像素补偿,确定最优合并模式及在所述最优合并模式下所述CTU的第一率失真代价C1;
    在C1小于预设的第一阈值的情况下,基于所述最优合并模式获得所述CTU的SAO参数;
    在C1不小于所述第一阈值的情况下,在边缘补偿EO模式下对所述CTU进行像素补偿,获得第二率失真代价C2;
    根据C2和C1,确定所述CTU的SAO参数。
  2. 根据权利要求1所述的方法,其中,所述在合并模式下对编码树单元CTU进行像素补偿,确定最优合并模式及在所述最优合并模式下所述CTU的第一率失真代价C1,包括:
    将目标阈值C0设置为预设的第二阈值,其中,所述第二阈值为大于所述第一阈值的值;
    在向左合并模式下对所述CTU进行像素补偿,获得第三率失真代价C3;
    在C3不小于C0的情况下,在向上合并模式下对所述CTU进行像素补偿,获得第四率失真代价C4;
    在C3小于C0的情况下,将向左合并模式确定为最优合并模式,C0更新为C3,在C0小于预设的第三阈值的情况下,确定在所述最优合并模式下所述CTU的第一率失真代价C1等于C3,其中,所述第三阈值为小于所述第二阈值的值;在C0不小于所述第三阈值的情况下,在向上合并模式下对所述CTU进行像素补偿,获得第四率失真代价C4;
    在C4小于C0的情况下,将向上合并模式确定为最优合并模式,且在所述最优合并模式下所述CTU的第一率失真代价C1等于C4;
    在C4不小于C0的情况下,确定在最优合并模式下所述CTU的第一率失真代价C1等于C0。
  3. 根据权利要求2所述的方法,其中,
    所述预设的第二阈值为:所述CTU的当前最佳编码代价。
  4. 根据权利要求1-3中任一项所述的方法,其中,所述在EO模式下对所述CTU进行像素补偿,包括:
    在EO模式下,按照预设的像素行间隔和/或预设的像素列间隔得到的偏移 值集合对所述CTU进行像素补偿。
  5. 根据权利要求1-3中任一项所述的方法,其中,在所述在合并模式下对编码树单元CTU进行像素补偿,确定最优合并模式及在所述最优合并模式下所述CTU的第一率失真代价C1之前,还包括:
    判断所述CTU是否为所在视频帧中的第一个CTU;
    如果所述CTU是所在视频帧中的第一个CTU,在EO模式下对所述CTU进行像素补偿,并基于EO模式获得所述CTU的SAO参数;
    所述在合并模式下对编码树单元CTU进行像素补偿,确定最优合并模式及在所述最优合并模式下所述CTU的第一率失真代价C1,包括:
    如果所述CTU不是所在视频帧中的第一个CTU,在合并模式下对CTU进行像素补偿,确定最优合并模式及在所述最优合并模式下所述CTU的第一率失真代价C1。
  6. 根据权利要求5所述的方法,其中,所述在EO模式下对所述CTU进行像素补偿,包括:
    从EO模式的各个预设EO类型中选择部分或者全部EO类型;
    分别在所选择的EO类型下对所述CTU进行像素补偿,获得所述CTU在所选择的各所选择的EO类型下的率失真代价;
    将所获得率失真代价中取值最小的率失真代价对应的像素补偿结果确定为EO模式下所述CTU的像素补偿结果。
  7. 根据权利要求5所述的方法,其中,所述在EO模式下对所述CTU进行像素补偿,并基于EO模式获得所述CTU的SAO参数,包括:
    在EO模式下对所述CTU进行像素补偿,获得第五率失真代价C5;
    判断C5是否小于所述CTU的当前最佳编码代价;
    如果C5不小于所述CTU的当前最佳编码代价,结束所述CTU的SAO模式决策,并跳过所述CTU所在视频帧中其他CTU的SAO模式决策;
    如果C5小于所述CTU的当前最佳编码代价,基于EO模式获得所述CTU的SAO参数。
  8. 根据权利要求1-3中任一项所述的方法,其中,所述根据C2和C1,确定所述CTU的SAO参数,包括:
    若C2小于C1,基于EO模式获得所述CTU的SAO参数;
    若C2不小于C1,基于所述最优合并模式获得所述CTU的SAO参数。
  9. 一种样本自适应补偿SAO模式决策装置,所述装置包括:
    模式确定模块,设置为在合并模式下对编码树单元CTU进行像素补偿,确定最优合并模式及在所述最优合并模式下所述CTU的第一率失真代价C1;
    第一判断模块,设置为判断C1是否小于预设的第一阈值,如果C1小于所述第一阈值,触发第一参数获得模块;如果C1不小于所述第一阈值,触发率失真代价获得模块;
    所述第一参数获得模块,设置为基于所述最优合并模式获得所述CTU的SAO参数;
    所述率失真代价获得模块,设置为在边缘补偿EO模式下对所述CTU进行像素补偿,获得第二率失真代价C2;
    第二参数获得模块,设置为根据C2和C1,确定所述CTU的SAO参数。
  10. 根据权利要求9所述的装置,其中,所述模式确定模块包括:阈值确定子模块、第一率失真代价获得子模块、第一判断子模块、最优合并模式确定子模块、第二判断子模块、第一率失真代价确定子模块、第二率失真代价获得子模块、第三判断子模块、第二率失真代价确定子模块和第三率失真代价确定子模块;
    所述阈值确定子模块,设置为将目标阈值C0设置为预设的第二阈值,其中,所述第二阈值为大于所述第一阈值的值;
    所述第一率失真代价获得子模块,设置为在向左合并模式下对所述CTU进行像素补偿,获得第三率失真代价C3;
    所述第一判断子模块,设置为判断C3是否小于C0,如果C3小于C0,触发所述最优合并模式确定子模块;如果C3不小于C0,触发所述第二率失真代价获得子模块;
    所述最优合并模式确定子模块,设置为将向左合并模式确定为最优合并模式,C0更新为C3;
    所述第二判断子模块,设置为判断C0是否小于预设的第三阈值,如果C0小于所述第三阈值,触发所述第一率失真代价确定子模块;如果C0不小于所述第三阈值,触发所述第二率失真代价获得子模块;
    所述第一率失真代价确定子模块,设置为确定在所述最优合并模式下所述CTU的第一率失真代价C1等于C3,其中,所述第三阈值为小于所述第二阈值的值;
    所述第二率失真代价获得子模块,设置为在向上合并模式下对所述CTU进行像素补偿,获得第四率失真代价C4;
    所述第三判断子模块,设置为判断C4是否小于C0,如果C4小于C0,触发所述第二率失真代价确定子模块;如果C4不小于C0,触发所述第三率失真代价确定子模块;
    所述第二率失真代价确定子模块,设置为将向上合并模式确定为最优合并模式,且在所述最优合并模式下所述CTU的第一率失真代价C1等于C4;
    所述第三率失真代价确定子模块,设置为确定在最优合并模式下所述CTU的第一率失真代价C1等于C0。
  11. 根据权利要求9所述的装置,其中,
    所述预设的第二阈值为:所述CTU的当前最佳编码代价。
  12. 根据权利要求9-11任一项所述的装置,其中,所述率失真代价获得模块具体设置为:
    在EO模式下,按照预设的像素行间隔和/或预设的像素列间隔得到的偏移值集合对所述CTU进行像素补偿。
  13. 根据权利要求9-11任一项所述的装置,其中,所述装置还包括:第二判断模块和第三参数获得模块;
    所述第二判断模块,设置为判断所述CTU是否为所在视频帧中的第一个CTU,如果所述CTU是所在视频帧中的第一个CTU,触发所述第三参数获得模块;如果所述CTU不是所在视频帧中的第一个CTU,触发所述模式确定模块;
    所述第三参数获得模块,设置为在EO模式下对所述CTU进行像素补偿,并基于EO模式获得所述CTU的SAO参数。
  14. 根据权利要求13所述的装置,其中,所述第三参数获得模块,具体设置为从EO模式的各个预设EO类型中选择部分或者全部EO类型;
    分别在所选择的EO类型下对所述CTU进行像素补偿,获得所述CTU在所选择的各所选择的EO类型下的率失真代价;
    将所获得率失真代价中取值最小的率失真代价对应的像素补偿结果确定为EO模式下所述CTU的像素补偿结果。
  15. 根据权利要求13所述的装置,其中,所述第三参数获得模块包括: 第三率失真代价获得子模块、第四判断子模块、跳过子模块和第一参数获得子模块;
    所述第三率失真代价获得子模块,设置为在EO模式下对所述CTU进行像素补偿,获得第五率失真代价C5;
    所述第四判断子模块,设置为判断C5是否小于所述CTU的当前最佳编码代价,如果C5不小于所述CTU的当前最佳编码代价,触发所述跳过子模块;如果C5小于所述CTU的当前最佳编码代价,触发所述第一参数获得子模块;
    所述跳过子模块,设置为结束所述CTU的SAO模式决策,并跳过所述CTU所在视频帧中其他CTU的SAO模式决策;
    所述第一参数获得子模块,设置为基于EO模式获得所述CTU的SAO参数。
  16. 根据权利9-11任一项所述的装置,其中,所述第二参数获得模块包括:第五判断子模块、第二参数获得子模块和第三参数获得子模块;
    所述第五判断子模块,设置为判断C2是否小于C1,如果C2小于C1,触发所述第二参数获得子模块;如果C2不小于C1,触发所述第三参数获得子模块;
    所述第二参数获得子模块,设置为基于EO模式获得所述CTU的SAO参数;
    所述第三参数获得子模块,设置为基于所述最优合并模式获得所述CTU的SAO参数。
  17. 一种电子设备,包括处理器和存储器;
    所述存储器,设置为存放计算机程序;
    所述处理器,设置为执行所述存储器上所存放的程序时,实现权利要求1-8任一所述的方法步骤。
  18. 一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-8任一所述的方法步骤。
PCT/CN2018/113021 2017-11-01 2018-10-31 Sao模式决策方法、装置、电子设备及可读存储介质 WO2019085942A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711058757.6A CN109756736B (zh) 2017-11-01 2017-11-01 Sao模式决策方法、装置、电子设备及可读存储介质
CN201711058757.6 2017-11-01

Publications (1)

Publication Number Publication Date
WO2019085942A1 true WO2019085942A1 (zh) 2019-05-09

Family

ID=66331359

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/113021 WO2019085942A1 (zh) 2017-11-01 2018-10-31 Sao模式决策方法、装置、电子设备及可读存储介质

Country Status (2)

Country Link
CN (1) CN109756736B (zh)
WO (1) WO2019085942A1 (zh)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111698511B (zh) * 2020-06-07 2022-09-16 咪咕文化科技有限公司 图像滤波方法、装置、设备及可读存储介质
CN111866507A (zh) * 2020-06-07 2020-10-30 咪咕文化科技有限公司 图像滤波方法、装置、设备及存储介质
CN111866506A (zh) * 2020-06-07 2020-10-30 咪咕文化科技有限公司 图像编码方法、装置、设备及可读存储介质
CN113068050B (zh) * 2021-03-17 2022-08-23 上海哔哩哔哩科技有限公司 树形编码块的样点自适应补偿模式确定方法、装置
CN113489984A (zh) * 2021-05-25 2021-10-08 杭州博雅鸿图视频技术有限公司 Avs3的样点自适应补偿方法、装置、电子设备及存储介质
CN114363613B (zh) * 2022-01-10 2023-11-28 北京达佳互联信息技术有限公司 滤波方法和滤波装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100220937A1 (en) * 2009-02-27 2010-09-02 Research In Motion Corporation Optimization of image encoding using perceptual weighting
CN105828084A (zh) * 2016-03-30 2016-08-03 腾讯科技(深圳)有限公司 Hevc帧间编码处理方法和装置
CN105933717A (zh) * 2016-04-25 2016-09-07 北京奇艺世纪科技有限公司 一种编码单元的模式决策方法和装置
CN106131554A (zh) * 2016-07-07 2016-11-16 杭州电子科技大学 基于主要边缘方向的hevc快速样点自适应补偿方法

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2509707B (en) * 2013-01-04 2016-03-16 Canon Kk A method, device, computer program, and information storage means for encoding or decoding a video sequence
US9628822B2 (en) * 2014-01-30 2017-04-18 Qualcomm Incorporated Low complexity sample adaptive offset encoding
JP2015216627A (ja) * 2014-04-23 2015-12-03 ソニー株式会社 画像処理装置及び画像処理方法
CN105979262B (zh) * 2016-05-06 2019-12-03 西安电子科技大学 一种hevc基于时间相关性和帧内预测方向的sao优化方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100220937A1 (en) * 2009-02-27 2010-09-02 Research In Motion Corporation Optimization of image encoding using perceptual weighting
CN105828084A (zh) * 2016-03-30 2016-08-03 腾讯科技(深圳)有限公司 Hevc帧间编码处理方法和装置
CN105933717A (zh) * 2016-04-25 2016-09-07 北京奇艺世纪科技有限公司 一种编码单元的模式决策方法和装置
CN106131554A (zh) * 2016-07-07 2016-11-16 杭州电子科技大学 基于主要边缘方向的hevc快速样点自适应补偿方法

Also Published As

Publication number Publication date
CN109756736A (zh) 2019-05-14
CN109756736B (zh) 2021-02-12

Similar Documents

Publication Publication Date Title
WO2019085942A1 (zh) Sao模式决策方法、装置、电子设备及可读存储介质
WO2020253828A1 (zh) 一种编解码方法、装置及存储介质
US10382795B2 (en) Method of video coding using binary tree block partitioning
US20180324417A1 (en) Intra reference filter for video coding
US20160373767A1 (en) Encoding and Decoding Methods and Apparatuses
US20230024834A1 (en) Video decoding method, video encoding method, and related apparatuses
US20210266534A1 (en) Intra-frame prediction coding method and apparatus, electronic device, and computer storage medium
CN109688407B (zh) 编码单元的参考块选择方法、装置、电子设备及存储介质
CN110199522A (zh) 处理用于图像块帧内预测的参考样本
CN113711597A (zh) 上下文建模和多重变换矩阵的选择
US20220116664A1 (en) Loop filtering method and device
WO2021185008A1 (zh) 编码方法、解码方法、编码器、解码器以及电子设备
TW202032993A (zh) 用於係數位準之逃逸寫碼
US11924459B2 (en) Method for inter prediction method, video picture encoder and decoder
WO2022252567A1 (zh) 基于相关度比较确定视频编解码优先顺序的方法及装置
JP2022521933A (ja) 符号化方法、復号化方法、デコーダ、エンコーダー及び記憶媒体
US8295349B2 (en) Methods and apparatuses for video compression intra prediction mode determination
CN110418138A (zh) 视频处理方法、装置、电子设备及存储介质
WO2022116085A1 (zh) 编码方法、解码方法、编码器、解码器以及电子设备
WO2021168817A1 (zh) 视频处理的方法及装置
CN108702521B (zh) 编码和解码方法、装置、编码器、解码器及存储介质
CN116982262A (zh) 视频编码中依赖性量化的状态转换
CN109951707B (zh) 一种目标运动矢量选择方法、装置、电子设备及介质
WO2020140214A1 (zh) 解码预测方法、装置及计算机存储介质
WO2023193253A1 (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: 18873508

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18873508

Country of ref document: EP

Kind code of ref document: A1