WO2022022013A1 - Mode selection method and apparatus, computer-readable storage medium and electronic device - Google Patents

Mode selection method and apparatus, computer-readable storage medium and electronic device Download PDF

Info

Publication number
WO2022022013A1
WO2022022013A1 PCT/CN2021/094198 CN2021094198W WO2022022013A1 WO 2022022013 A1 WO2022022013 A1 WO 2022022013A1 CN 2021094198 W CN2021094198 W CN 2021094198W WO 2022022013 A1 WO2022022013 A1 WO 2022022013A1
Authority
WO
WIPO (PCT)
Prior art keywords
candidate
mode
angle
modes
directions
Prior art date
Application number
PCT/CN2021/094198
Other languages
French (fr)
Chinese (zh)
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 WO2022022013A1 publication Critical patent/WO2022022013A1/en

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/103Selection of coding mode or of prediction mode
    • 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/70Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards

Definitions

  • the present disclosure belongs to the technical field of video coding, and in particular, relates to a mode selection method, an apparatus, a computer-readable storage medium, and an electronic device.
  • the video is often encoded by using a preset video encoding standard to reduce the amount of data to be transmitted.
  • the video image is often divided into coding tree units (coding tree units, CTUs) first, CTUs are divided into coding units (Coding units, CUs), and CUs are divided into prediction units (prediction, unit, PU).
  • CTUs coding tree units
  • CUs Coding units
  • prediction units prediction units
  • PU prediction units
  • a candidate list is generated according to the candidate mode, and the optimal mode corresponding to the coded PU adjacent to the current PU is also added to the candidate list.
  • the current PU is traversed by using the candidate modes in the candidate list to select a mode with better coding effect for the current PU, for example, the optimal mode, and use this mode to complete the coding of the current PU.
  • all modes are often used as the screening basis, and the coding effect parameters of the current CU in each mode are calculated in turn, for example, the rate-distortion cost is calculated, and then according to the corresponding The encoding effect parameter filters candidate modes.
  • the coding effect parameters of the current CU in each mode are calculated in turn, for example, the rate-distortion cost is calculated, and then according to the corresponding The encoding effect parameter filters candidate modes.
  • the present disclosure provides a mode selection method, device, computer-readable storage medium and electronic device, which solve the problems of large amount of calculation, long time consumption and low efficiency when mode selection is performed to a certain extent .
  • the present disclosure provides a mode selection method, which may include:
  • the direction represented by the angle representative mode is used as an alternative direction, and the first direction corresponding to the current PU is determined from the alternative directions according to the coding effect parameters of the current prediction unit PU in each of the angle representative modes;
  • the encoding effect parameter in the angle representative mode corresponding to the first direction satisfies the first preset condition;
  • a candidate direction is selected from the candidate directions according to the first direction; the candidate directions include at least the first direction;
  • a candidate pattern is selected from patterns provided by the preset coding standard.
  • a mode selection apparatus which may include:
  • a first selection mode used for selecting m angle representative modes from the angle modes provided by the preset coding standard; the m is less than the number of angle modes provided by the preset coding standard;
  • a first determination mode configured to use the direction represented by the angle representative mode as a candidate direction, and determine the current PU from the candidate directions according to the coding effect parameters of the current prediction unit PU in each of the angle representative modes The corresponding first direction; the angle corresponding to the first direction represents that the encoding effect parameter in the mode satisfies the first preset condition;
  • a second selection mode configured to select a candidate direction from the candidate directions according to the first direction; the candidate directions include at least the first direction;
  • the third selection mode is used to select a candidate mode from modes provided by the preset coding standard based on modes around the candidate direction.
  • the present disclosure provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the mode selection method according to the first aspect is implemented.
  • the present disclosure provides an electronic device comprising: a processor, a memory, and a computer program stored on the memory and executable on the processor, wherein the processor executes the program When implementing the mode selection method described in the first aspect.
  • the present disclosure has the following advantages:
  • the direction represented by the angle representative mode is taken as an alternative direction, and according to the current prediction unit PU
  • a first direction corresponding to the current PU is selected from the candidate directions, and then a candidate direction is selected from the candidate directions according to the first direction, and the candidate directions at least include the first direction.
  • a candidate mode is selected from the modes provided by the preset coding standard.
  • the candidate direction in which the optimal mode may be located is determined by first selecting the angle representative mode, and the candidate mode is only selected in the mode around the candidate direction, that is, the direction with a small probability of having a mode with better coding effect is excluded,
  • the candidate direction that is, the partial mode
  • the candidate direction that is, the partial mode
  • FIG. 1 is a schematic diagram of a mode provided by an embodiment of the present disclosure
  • FIG. 2 is a flowchart of steps of a mode selection method provided by an embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of another mode provided by an embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of a division provided by an embodiment of the present disclosure.
  • FIG. 6 is a schematic diagram of a gradient direction of a computing block provided by an embodiment of the present disclosure.
  • FIG. 7 is a schematic diagram of a gradient direction of a PU provided by an embodiment of the present disclosure.
  • FIG. 8 is a block diagram of a mode selection apparatus provided by an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • Figure 10 schematically shows a memory unit for holding or carrying program code implementing the method according to the present disclosure.
  • a video coding standard can provide multiple coding prediction modes. When using each mode to encode the same PU in a video image, the degree of image distortion and encoding bit rate will be different. Further, because different video images of different videos contain different image contents and are affected by the differences in contents, when different PUs are encoded using the same mode, the image distortion degree and encoding bit rate will also be different.
  • the HEVC standard is a commonly used new-generation video coding standard, and its purpose is to address people's increasing demands for visual and auditory quality.
  • the intra-frame prediction technology it provides is designed to eliminate spatial correlation in video data. According to the principle that the spatially closer pixels have a stronger correlation, it can use the principle of weighting adjacent pixels to predict the current pixel according to the correlation between the pixels. In this way, only the prediction residual needs to be If the difference is transformed and quantized, the amount of data to be transmitted can be greatly reduced.
  • the HEVC standard provides a large number of modes. Specifically, the modes provided by the HEVC standard include two non-angle modes and 33 angle modes. By way of example, FIG.
  • FIG. 1 is a schematic diagram of a mode provided by an embodiment of the present disclosure.
  • “0Intra_Planar” and “1Intra_DC” respectively represent two non-angular modes: planar mode and DC mode, and 2 to 34 respectively represent 33 Medium angle mode.
  • planar mode planar mode
  • DC mode DC mode
  • 2 to 34 respectively represent 33 Medium angle mode.
  • an embodiment of the present disclosure proposes a mode selection method to simplify screening.
  • FIG. 2 is a flowchart of steps of a mode selection method provided by an embodiment of the present disclosure. As shown in FIG. 2 , the method may include:
  • Step 201 From the angle modes provided by the preset coding standard, select m angle representative modes; the m is less than the number of angle modes provided by the preset coding standard.
  • the preset encoding standard may be a standard for encoding the video to be encoded.
  • the preset coding standard may be selected according to actual requirements, for example, the preset coding standard may be the HEVC standard.
  • the angles represented by different angle modes are different, but the directions indicated by the angle modes with approximate angles are generally similar.
  • the angle pattern 11 indicating the horizontal direction is compared with other angle patterns adjacent to both sides thereof, such as the angle pattern 10 and the angle pattern 12 , the horizontal direction indicated by the angle pattern 11 is relatively
  • the horizontal directions indicated by the angle patterns 10 and 12 are more precise, but all three generally point to the horizontal direction.
  • the angle pattern 26 indicating the vertical direction is compared with other angle patterns adjacent to both sides thereof, such as the angle pattern 25 and the angle pattern 27, the vertical direction indicated by the angle pattern 26 is compared with that of the angle pattern 25.
  • the vertical direction indicated by , 27 is more accurate, but the three generally point to the horizontal direction. Therefore, in this step, a part of the angle pattern can be selected as the angle representative pattern first, and an angle representative pattern represents that the angle can represent other patterns around the direction indicated by the pattern, that is, represents an angle pattern interval, and then realizes the use of these m
  • the angle representative mode represents the angle mode provided by the preset coding standard.
  • the specific value of m can be set according to the actual situation. For example, since the larger m is, the less representative modes of angles are selected, and the fewer modes that need to be processed subsequently, that is, the less computation is required, but correspondingly, the representativeness of the representative modes of angles will be weaker, and the screening The precision will be less. Conversely, the smaller m is, the more angle representative modes are selected, and the more modes that need to be processed subsequently, that is, the more calculation amount will be, but correspondingly, the representativeness of the angle representative mode will be stronger, and the screening accuracy will be stronger. will be higher. Therefore, in the embodiment of the present disclosure, a matching value may be selected as m according to the processing capability of the encoder and the requirement for the screening accuracy.
  • m is less than the number of angle modes provided by the preset coding standard, it can be ensured to a certain extent that the mode of determining the candidate mode by selecting part of the angle modes as the angle representative mode results in a small amount of calculation and consumes less energy. The time is small, and the calculation efficiency is improved to a certain extent.
  • Step 202 Use the direction indicated by the angle representative mode as an alternative direction, and determine the first corresponding to the current PU from the alternative directions according to the coding effect parameters of the current prediction unit PU in each of the angle representative modes. direction; the angle corresponding to the first direction represents that the encoding effect parameter in the mode satisfies the first preset condition.
  • an angle representing the direction represented by the pattern may be used as a candidate direction, and then m candidate directions are obtained.
  • 4 angle representation modes are selected: 10, 26, 2, and 18, and their respective directions may be: horizontal direction, vertical direction, lower-left direction, and upper-left direction. Then correspondingly, these four directions can be determined as candidate directions.
  • the direction represented by each angle represented by the mode can be a relative direction. In modes with different representations, the direction corresponding to the same angle represented by the mode can be different, and the direction represented by the angle represented by the mode can also be extended in the opposite direction. direction. But the relative relationship of the directions represented by the various angles representing the mode is determined.
  • FIG. 3 is a schematic diagram of another mode provided by an embodiment of the present disclosure. As shown in FIG. 3 , the direction corresponding to the angle representative mode 18 at this time is the lower right direction, that is, the direction represented by 18 can be understood as the lower right direction direction.
  • the encoding effect parameter of the current PU in the angle representative mode may be a parameter that can reflect the degree of image distortion and the size of the encoding bit rate for encoding the current PU using the angle representative mode. Because the main purpose of video coding is often to reduce the bit rate as much as possible under the condition of ensuring a certain video quality, or reduce the distortion as much as possible under the condition of ensuring a certain bit rate. Therefore, the rate-distortion cost can be used as a coding effect parameter, thereby reflecting the effect of coding the current PU by using the angle representative mode.
  • the first direction may be an alternative direction with better coding effect parameters in the corresponding angle representative mode.
  • the first preset condition may be set according to the actual situation, as long as it is ensured that the encoding effect of the current PU is better by using the angle representative mode corresponding to the encoding effect parameter that satisfies the first preset condition.
  • the first preset condition may be that the encoding effect parameter is smaller than the preset parameter threshold, or the encoding effect represented by the encoding effect parameter is the best.
  • the candidate direction whose corresponding rate-distortion cost is less than the preset parameter threshold can be determined as the first direction, or is to determine the corresponding candidate direction with the smallest rate-distortion cost as the first direction, that is, the direction with the smallest rate-distortion cost in the candidate directions is used as the first direction.
  • Step 203 Select a candidate direction from the candidate directions according to the first direction; the candidate directions include at least the first direction.
  • the candidate direction may be selected from the candidate directions according to the first direction. Specifically, according to the first direction, a direction with a higher probability that a mode with better coding effect exists among the surrounding modes may be selected as a candidate direction.
  • Step 204 Based on the patterns around the candidate direction, select a candidate pattern from patterns provided by the preset coding standard.
  • the candidate direction since the candidate direction is determined according to the first direction and includes at least the first direction, it can be considered that there is a mode with better coding effect for the current PU in the modes around the candidate direction.
  • the candidate mode may be selected from the modes provided by the preset coding standard based on the modes around the candidate direction.
  • the angle patterns around the candidate direction may be partial angle patterns provided by the preset coding standard, that is, the number of angle patterns around the candidate direction is smaller than the number of angle patterns provided by the preset coding standard. In this way, the candidate modes included in the angle modes can be determined only by calculating part of the angle modes, thereby reducing the amount of calculation to a certain extent.
  • the mode selection method provided by the embodiment of the present disclosure selects m angle representative modes from the angle modes provided by the preset coding standard, where m is smaller than the number of angle modes provided by the preset coding standard, and takes the direction represented by the angle representative mode as an alternative direction, and according to the encoding effect parameters of the current prediction unit PU in each angle representative mode, select a first direction corresponding to the current PU from the alternative directions, and then select a candidate direction from the alternative directions according to the first direction,
  • the candidate directions include at least the first direction.
  • a candidate mode is selected from the modes provided by the preset coding standard.
  • the candidate direction in which the optimal mode may be located is determined by first selecting the angle representative mode, and the candidate mode is only selected in the mode around the candidate direction, that is, the direction with a small probability of having a mode with better coding effect is excluded,
  • the candidate direction that is, the direction with a small probability of having a mode with better coding effect is excluded.
  • screening for multiple angle modes only the modes around the candidate directions, that is, some modes, are used as the basis for screening. In this way, the number of modes that need to be judged when screening candidate modes can be reduced to a certain extent, thereby reducing the amount of calculation and consumption. , improve efficiency.
  • FIG. 4 is a flowchart of steps of another mode selection method provided by an embodiment of the present disclosure. As shown in FIG. 4 , the method may include:
  • Step 301 From the angle modes provided by the preset coding standard, select m angle representative modes; the m is less than the number of angle modes provided by the preset coding standard.
  • this step can be implemented by the following operations: starting from the preset angle mode, selecting m angle modes at equal intervals from the angle modes provided by the preset coding standard in sequence according to the second preset step size; The m angle patterns of are taken as the angle representative patterns.
  • the angle pattern at the starting point can be extracted, and then starting from the first extracted angle pattern, the angle pattern reached after the second preset step is extracted, and then starting from the currently extracted angle pattern , extracting the angle pattern reached after the second preset step, and so on, until enough m angle pattern positions are extracted.
  • the preset angle mode and the second preset step size may be preset according to actual conditions.
  • the angle mode 2 may be used as the preset angle mode, or the angle mode 34 may be used as the preset angle mode, and the second preset step size is set to 8.
  • the preset angle mode is used as angle mode 2
  • the angle mode 34 may be used as the preset angle mode
  • the second preset step size is set to 8.
  • the preset angle mode is 8
  • m is 4 as an example, you can first extract angle mode 2, and then start from angle mode 2, extract the position reached after 8 steps.
  • angle pattern 10 then, starting from the angle pattern 10, extract the angle pattern 18 where it reaches after 8 steps, and starting from the angle pattern 18, extract the angle pattern 26 where it reaches after 8 steps, and obtain four Angle mode: angle mode 2, angle mode 10, angle mode 18, angle mode 26.
  • the four angle patterns can be determined as angle representative patterns.
  • extraction is performed at equal intervals by the second preset step size, so that it can be ensured that the finally obtained angle representative patterns are evenly distributed in the angle patterns, thereby ensuring that each angle representative pattern can evenly represent its surroundings. angle mode, improving the reliability of selection based on the angle representative mode.
  • Step 302 Use the direction represented by the angle representative mode as a candidate direction, and calculate the rate-distortion cost of the current PU in each of the angle representative modes.
  • each angle representative mode the following operations may be performed respectively to calculate the rate-distortion cost of the current PU in each angle representative mode:
  • is a preset coefficient.
  • the distortion degree D of the current PU in the angle representative mode is obtained, and the current PU is calculated in combination with the distortion degree D.
  • D is represented by SATD, so that the rate-distortion cost of the current PU in this angle representative mode can be calculated without encoding. Therefore, the calculation cost of the rate-distortion cost can be reduced to a certain extent, and the rate-distortion cost of the rate-distortion cost can be improved to a certain extent. Computational efficiency.
  • the degree of distortion D can also be used directly for calculation, or other parameters can be used to indicate that D participates in the calculation, for example, using the sum of absolute error (Sum of Absolute Difference, SAD), the sum of squared differences (Sum of Squared Difference, SSD) , etc., which are not limited in the embodiments of the present disclosure.
  • SAD Sum of Absolute Difference
  • SSD Sum of Squared Difference
  • Step 303 Determine the candidate direction corresponding to the angle representative mode with the smallest rate-distortion cost as the first direction.
  • the magnitude of the rate-distortion cost corresponding to each angle representative mode can be compared, and then the rate-distortion cost with the smallest value is selected. Then, the angle corresponding to the minimum rate-distortion cost is an alternative corresponding to the mode representative mode.
  • the direction is determined as the first direction. For example, assuming that the candidate direction corresponding to the angle representative mode corresponding to the minimum rate-distortion cost is the horizontal direction, the horizontal direction may be determined as the first direction.
  • the selected first direction can be the one with the most encoding effect on the current PU.
  • a good direction can further ensure the reliability of the candidate direction selected based on the first direction in the subsequent steps.
  • Step 304 According to the gradient strength of the current PU in each of the candidate directions, select a second direction corresponding to the current PU from the candidate directions; the gradient strength in the second direction satisfies the second preset condition.
  • the gradient may be a vector with magnitude and direction
  • the direction of the gradient may be the direction indicating the change of the pixel value, that is, the direction of the texture of the image may be represented.
  • the size can be the size of the gradient strength, which can characterize how fast the pixel value of the pixel changes in this direction.
  • the gradient strength in the alternative direction can represent the magnitude of the gradient, that is, it can be used to represent how fast the pixel value of the pixel point in the current PU changes in the alternative direction. The smaller the gradient strength is, the smaller the speed is, that is, the slower the pixel value of the pixel point changes in the alternative direction.
  • the degree of change of the pixel value in the alternative direction may reflect the texture of the image texture in the current PU in the alternative direction.
  • the slower the change the stronger the texture.
  • the second direction may be a corresponding candidate direction with a smaller gradient intensity, that is, a candidate direction with relatively slow change and strong texture of the image texture.
  • the second preset condition may be set according to the actual situation, as long as it is ensured that the change of the pixel value in the direction satisfying the second preset condition is relatively slow.
  • the second preset condition may be that the gradient strength is smaller than the preset gradient threshold, or the gradient strength is the smallest, that is, the smallest gradient direction among the alternative directions is used as the second direction.
  • this step can be implemented through the following steps 3041 to 3044:
  • Step 3041 Divide the current PU into at least two calculation blocks, wherein one of the calculation blocks includes at least two pixels.
  • the number of pixels included in the calculation block may be set according to the candidate direction.
  • the set number is not less than 2
  • the set number is not less than 3.
  • the set number is not less than 4.
  • the shape of the calculation block may be a square, a rectangle, or the like. Not limited. Specifically, when dividing, starting from a preset position, for example, starting from the upper left corner of the current PU, at least two pixels are sequentially selected as a calculation block, and then multiple calculation blocks are obtained. For example, taking the current PU as an 8*8 area as an example, FIG.
  • FIG. 5 is a schematic diagram of a division provided by an embodiment of the present disclosure.
  • the forward direction area composed of every 16 pixels can be divided into one Calculation block, and then 4 calculation blocks are obtained, wherein the 4 calculation blocks are: 4*4 pixel blocks covered by slashes, 4*4 pixel blocks covered by black dots, 4*4 pixel blocks covered by horizontal lines and A 4*4 pixel block covered by vertical lines.
  • the embodiment of the present disclosure can avoid the problem of repeated calculation due to the existence of repeated parts.
  • Step 3042 For any of the candidate directions, calculate the gradient strength of the calculation block in the candidate direction according to the pixel values of the pixel points included in each of the calculation blocks.
  • calculating the gradient strength of the calculation block in the candidate direction is to use the candidate direction as the gradient direction, and calculate the gradient strength of the calculation block in the gradient direction.
  • the gradient strength of the calculation block in the alternative direction can be calculated by the following operations: according to the alternative direction, n pairs of pixel points are selected at intervals from the calculation block as reference pixel points pair; perform differential calculation based on the pixel points included in the reference pixel point pair; determine the result of the differential calculation as the gradient strength of the calculation block in the candidate direction.
  • n may be set according to the actual situation.
  • two non-adjacent pixels may be selected at intervals in the alternative direction to form a reference pixel pair.
  • the non-adjacent pixels may refer to the non-adjacent up, down, left and right, that is, to ensure that there are no pixels in the reference pixel pair that are 4 adjacent pixels to each other.
  • the upper right and lower right are not adjacent, that is, it is ensured that there are no pixels that are 8 neighboring pixels to each other in the reference pixel pair.
  • difference is also known as difference function or difference operation, and the result of difference can reflect a change between discrete quantities.
  • the absolute value of the pixel value difference between the two pixel points in each reference pixel point pair can be calculated, and then the sum of all absolute values can be calculated to obtain the difference result.
  • the difference result in the alternative direction is used as the gradient strength of the calculation block in the alternative direction.
  • the calculation block is a 4*4 calculation block divided in FIG. 5 , and n is 4. From any vertex of the calculation block as the origin, the pixels are numbered according to 0, 1, 2, and 3 along the horizontal X-axis direction and the vertical Y-axis direction respectively, then, the gradient strength of a calculation block in the horizontal direction GH can be expressed as:
  • G H
  • the gradient strength G v in the vertical direction can be expressed as:
  • G V
  • the gradient strength G rd in the lower right direction can be expressed as:
  • G rd
  • the gradient strength G ld in the lower left direction can be expressed as:
  • G ld
  • FIG. 6 is a schematic diagram of a gradient direction of a calculation block provided by an embodiment of the present disclosure. It can be seen that the gradient direction of the calculation block includes the horizontal direction shown in (3a), the vertical direction shown in (3b), The lower right direction shown in 3c) and the lower left direction shown in (3d).
  • Step 3043 Calculate the gradient strength corresponding to the current PU in the candidate direction according to the gradient strength of the calculation block in the candidate direction.
  • FIG. 7 is a schematic diagram of a gradient direction of a PU provided by an embodiment of the present disclosure, and it can be seen that the gradient directions of the PU include the horizontal direction shown in (4a), the vertical direction shown in (4b), and (4c) The lower right direction shown and the lower left direction shown by (4d).
  • the current PU by dividing the current PU into multiple calculation blocks, and taking the calculation blocks as the gradient calculation objects, it is only necessary to calculate the gradient strengths of these calculation blocks in the alternative directions, and the calculation can be done based on the gradient strengths of these calculation blocks.
  • the gradient strength corresponding to the current PU in the alternative direction is obtained.
  • the gradient calculation process can be simplified to a certain extent, the calculation amount caused by the gradient calculation can be reduced, and the calculation efficiency can be improved.
  • taking the current PU in FIG. 5 as an example, if a conventional calculation method is used and no division is performed, it is necessary to calculate the gradient strengths of the 64 pixels in the alternative directions for the 64 pixels respectively, and obtain 64 gradient strength.
  • the 64 gradient strengths are calculated to obtain the gradient strength of the current PU in the alternative direction.
  • the calculation method provided by the embodiment of the present disclosure it is only necessary to calculate the gradient intensities of the four calculation blocks in the alternative directions, and obtain four gradient intensities. Then, these four gradient strengths are calculated to obtain the gradient strength of the current PU in the alternative direction. It can be seen that, compared with the prior art, in which the pixel points in the current PU are differentiated point by point in the alternative directions, the method provided by the embodiment of the present disclosure can simplify the gradient calculation process and reduce the burden caused by the gradient calculation. the amount of computation, thereby improving the computational efficiency.
  • the pixel points are extracted at intervals to participate in the calculation, which can reduce the number of pixel points participating in the calculation, thereby further reducing the amount of calculation.
  • the method of extracting pixel points at intervals to participate in the calculation can also avoid that the difference between the adjacent points is too small, resulting in the final calculation result being unable to be calculated. Accurately reflect the texture of the problem.
  • the gradient intensity may also be calculated in other ways, for example, by calculating the derivative by using a two-dimensional discrete function, and so on, which is not limited in this embodiment of the present disclosure.
  • low-pass filtering may also be performed on the video image to reduce interference information contained in the video image, thereby improving texture detection effect.
  • Step 3044 Determine the corresponding candidate direction with the smallest gradient strength as the second direction.
  • the magnitudes of the gradient strengths corresponding to each candidate direction may be compared, and then the gradient strength with the smallest value is selected, and then the candidate direction corresponding to the minimum gradient strength is determined as the second direction.
  • the horizontal direction may be determined as the second direction.
  • Step 305 Select the candidate direction from the candidate directions according to the relative relationship between the first direction and the second direction.
  • the texture direction of the video image is often similar to the direction of the mode with better coding effect, for example, the direction of the optimal mode is similar, and the direction of the mode with better coding effect is similar.
  • the encoding effect will be affected by the image texture, and the second direction can represent the direction with strong regularity of the image texture of the current PU. Therefore, in this embodiment of the present disclosure, the first direction can be combined. and the second direction, that is, the candidate direction is selected by combining the minimum cost direction and the minimum gradient direction.
  • the candidate direction indicated by the first direction is determined as the candidate direction. If the first direction is parallel to the second direction, it means that the minimum cost direction and the minimum gradient direction are consistent, the image represented by the current PU has strong texture, the texture detection result is reliable, and the reference is high, that is, the determined first Both directions are reliable. However, since the first direction is similar to the second direction, if the second direction is reliable, the first direction can be considered to be reliable, and then only the candidate direction represented by the first direction can be determined as a candidate direction. That is, only the second direction is determined as a candidate direction.
  • the candidate direction represented by the two is selected as the candidate direction, which can ensure that the candidate direction can be more accurate in the future based on the candidate direction. While screening candidate modes, reduce the number of candidate directions as much as possible, thereby reducing the amount of subsequent processing.
  • the two are not parallel, it can be further determined whether the two are perpendicular, and if the first direction is perpendicular to the second direction, at least two of the candidate directions are selected as the candidate directions. If the first direction is perpendicular to the second direction, it means that there is a big difference between the minimum cost direction and the minimum gradient direction, the texture of the image represented by the current PU is weak, and the result of texture detection is less reliable, that is, it can be considered that The reliability of the first direction is low, and the reference is low and high. And the weak texture is often caused by the complex texture of the image, or the lack of texture details. In this case, if the candidate mode is only determined in a single direction, it may lead to the final selection based on the candidate mode.
  • the selected at least two candidate directions may include the candidate direction represented by the first direction. Since the first direction is an alternative direction with better coding effect parameters in the corresponding angle representative mode, selecting the first direction can further ensure the optimal selection determined by the candidate mode selected based on the candidate direction to a certain extent. The encoding effect of the mode. Further, all candidate directions may be selected as candidate directions. Taking 4 candidate directions as an example, the 4 candidate directions can be determined as candidate directions, and candidates can be made in these 4 directions. In this way, by determining all the candidate defense lines as candidate directions, the coverage direction can be greatly improved, thereby ensuring the coding effect of the optimal mode determined based on the candidate modes screened in the candidate direction subsequently.
  • the candidate direction represented by the first direction and the candidate direction represented by the second direction are determined. is a candidate direction; wherein, the preset angle is an angle other than 0 degrees and 90 degrees.
  • the candidate directions represented by the first direction and the candidate directions represented by the second direction may be selected as candidate directions. In this way, by simultaneously selecting the candidate directions represented by the first direction and the second direction as the candidate directions, the problem of low reference can be compensated to a certain extent, thereby improving the accuracy of the candidate directions.
  • the minimum gradient direction is used to assist the judgment, and according to the judgment result, the candidate direction is selected in a targeted manner. Further, the accuracy of the candidate directions that are initially screened can be improved. Since the candidate directions of the preliminary screening have a great influence on the mode finally selected by the scheme, in the embodiment of the invention, by improving the accuracy, the overall accuracy of the scheme can be ensured.
  • Step 306 For any of the candidate directions, centering on the angle pattern corresponding to the candidate direction, according to the first preset step size, select p patterns at equal intervals from the patterns on both sides of the corresponding angle pattern. , as the first alternative mode.
  • the first preset step size may be preset according to the actual situation, and the first preset step size may be greater than 1.
  • the first preset step size may be 2.
  • the specific value of p may also be preset according to the actual situation, for example, p may be 4.
  • the angle pattern corresponding to the candidate direction may be taken as the center, and the corresponding angle pattern and the patterns on both sides thereof may be selected as objects. Start the selection at equal intervals with the first preset step.
  • the first preset step size is 2 and p is 4.
  • the candidate direction is the horizontal direction
  • the angle pattern corresponding to the candidate direction is the angle pattern 10
  • the first angle pattern 7 or the angle pattern 13 can be used as the starting point. , first extract the angle pattern at the starting point, then start from the extracted angle pattern, extract the angle pattern reached after the first preset step, and so on, the first alternative pattern can be obtained: angle pattern 7 , Angle Mode 9, Angle Mode 11, Angle Mode 13.
  • the candidate direction is the vertical direction and the angle mode corresponding to the candidate direction is the angle mode 26
  • p modes are selected at equal intervals from both sides of the corresponding angle mode, and the first candidate mode can be obtained: the angle mode 23, Angle Mode 25, Angle Mode 27, Angle Mode 29.
  • the candidate direction is the lower right direction and the angle mode corresponding to the candidate direction is the angle mode 18, select p modes at equal intervals from both sides of the corresponding angle mode, and the first candidate mode can be obtained: angle mode 15, angle mode 17.
  • Angle Mode 19 Angle Mode 21.
  • select p modes at equal intervals from both sides of the corresponding angle mode, and the first candidate modes can be obtained: angle mode 3, angle mode 5 , Angle Mode 31, Angle Mode 33.
  • selection and extraction are performed at equal intervals by the first preset step size, so that the final obtained first candidate mode can be uniformly distributed, thereby facilitating further selection on the basis of the first candidate mode in the future.
  • Step 307 Determine a first candidate mode according to the first candidate mode, and determine a non-angular mode provided by the preset coding standard as a second candidate mode.
  • the operation of determining the first candidate mode according to the first candidate mode may be implemented by the following operations: calculating the rate-distortion cost of the current PU in each of the first candidate modes; The first candidate mode corresponding to the distortion cost is used as the second candidate mode; the angle modes adjacent to both sides of the second candidate mode are determined as the first candidate mode.
  • the specific value of q is set according to the actual situation. For example, q may be 2.
  • the rate-distortion costs may be sorted in descending order, and then the first candidate mode corresponding to the first two rate-distortion costs may be selected as the second candidate mode. Assuming that the second candidate angle modes are angle mode 7 and angle mode 13 , the selected first candidate modes may be angle mode 6 , angle mode 8 , angle mode 12 , and angle mode 14 .
  • deduplication processing may be performed on the first candidate mode, so as to reduce the number of the first candidate mode, thereby reducing the subsequent calculation amount.
  • the first candidate mode can also be directly determined as the first candidate mode, that is, the operation of further screening is omitted, thereby reducing the amount of calculation.
  • the non-angle mode can be directly determined as the second candidate mode, that is, It is ensured that non-angle mode can also be added to screening, which can improve the screening efficiency while ensuring comprehensive coverage and comprehensive screening, thereby improving the accuracy of screening results.
  • the preset coding standard as the HEVC standard as an example, we may determine the planar mode and the dc mode as the second candidate mode.
  • Step 308 Determine the first candidate mode and the second candidate mode as the candidate mode, and add the angle representative mode and the first candidate mode to the candidate mode.
  • the first candidate mode and the second candidate mode are obtained through multi-level screening, and finally the first candidate mode and the second candidate mode are determined as candidate modes, which can ensure the accuracy of the final selected candidate mode to a certain extent. sex. Further, by adding the angle representative mode and the first candidate mode to the candidate modes, that is, the angle representative mode is used as the first-level candidate mode, and the first candidate mode and the non-angle mode are used as the second-level candidate mode. In the candidate mode, the first candidate mode is regarded as the third-level candidate mode.
  • the following operations may be performed: determine the rate-distortion cost corresponding to the candidate mode; if the rate-distortion cost corresponding to the candidate mode is greater than a preset value If the rate-distortion cost threshold is set, the candidate mode is eliminated. Wherein, if the corresponding rate-distortion cost has been calculated for the candidate mode in the foregoing steps, the corresponding rate-distortion cost can be obtained directly from the calculation result of the foregoing steps, thus reducing the amount of computation. If not, the calculation can be performed with reference to the description of the calculation method in the preceding steps.
  • the preset rate-distortion cost threshold may be set according to the rate-distortion cost corresponding to a mode that does not become the optimal mode in an actual application scenario. Alternatively, it can also be set according to the minimum rate-distortion cost calculated during the experiment, for example, the threshold is set to 1.2 times the minimum rate-distortion cost. Wherein, the minimum rate-distortion cost may be based on the rate-distortion cost calculated by SATD.
  • the rate-distortion cost corresponding to the candidate mode is greater than the preset rate-distortion cost threshold, it can be considered that the candidate mode has a high probability that it will not become the optimal mode, so it can be eliminated.
  • the rate-distortion cost corresponding to the candidate mode is greater than the preset rate-distortion cost threshold, it can be considered that the candidate mode has a high probability that it will not become the optimal mode, so it can be eliminated.
  • the number of candidate modes can be reduced, thereby reducing the amount of calculation in subsequent screening from the candidate modes.
  • a candidate list may be generated based on the previously selected candidate mode, the MPM mode may be determined according to the optimal mode of the coded PU around the current PU, and then the MPM mode may also be added to the candidate list for subsequent selection.
  • the MPM mode may be determined from the optimal modes of the coded adjacent PUs, eg, the upper and left coded adjacent PUs, according to the spatial correlation of the coded adjacent PUs.
  • the specific number of specific MPM modes can be set according to the actual situation. For example, in the simulation platform HM16.0, the number of MPMs can be 3.
  • the coded adjacent PUs on the upper and left sides can be obtained first. Then, according to the characteristics of the two optimal modes and the relationship between them, the three MPMs are assigned values in turn, and then three MPM modes are obtained.
  • the rate-distortion cost based on RDO can be calculated for all modes in the candidate list in turn, and the prediction mode with the smallest rate-distortion cost is selected as the optimal mode.
  • the solution of the RDO cost includes a complete encoding process, so the optimal mode can be accurately selected, but this process requires DCT transformation of the residual of the predicted pixels, quantization to obtain residual coefficients, and entropy encoding to obtain the prediction mode.
  • the rate-distortion cost of the prediction mode can be calculated according to the number of bits and the distortion degree, and the complexity is extremely high.
  • the pattern included in the candidate list may also be deduplicated, so as to reduce the number of objects to be calculated in the FMD stage, thereby reducing the amount of calculation.
  • the mode selection method provided by the embodiment of the present disclosure selects m angle representative modes from the angle modes provided by the preset coding standard, where m is smaller than the number of angle modes provided by the preset coding standard, and takes the direction represented by the angle representative mode as Alternative directions, and according to the coding effect parameters of the current prediction unit PU in each angle representative mode, select the first direction corresponding to the current PU from the alternative directions, and according to the gradient strength of the current PU in each alternative direction, from the alternative directions In the selection direction, select the second direction corresponding to the current PU. Then, combining these two directions, a candidate direction is selected from the candidate directions.
  • the first candidate mode is determined from the angle modes
  • the non-angle mode is determined as the second candidate mode
  • the first candidate mode and the second candidate mode are determined as the candidate modes.
  • the non-angle mode as the second candidate mode, that is, let the non-angle mode Screening can also be added to ensure comprehensive coverage while improving screening efficiency, thereby improving the accuracy of screening results.
  • the first direction and the second direction that is, combining the minimum cost direction and the minimum gradient direction
  • a double verification judgment is performed, the minimum gradient direction is used to assist the judgment, and according to the judgment result, the candidate direction can be selected in a targeted manner, which can improve the The accuracy of the initially screened candidate directions.
  • FIG. 8 is a block diagram of a mode selection apparatus provided by an embodiment of the present disclosure. As shown in FIG. 8 , the apparatus 40 may include:
  • the first selection mode 401 is used to select m angle representative modes from the angle modes provided by the preset coding standard; the m is less than the number of angle modes provided by the preset coding standard;
  • the first determination mode 402 is configured to use the direction represented by the angle representative mode as an alternative direction, and determine the current direction from the alternative directions according to the coding effect parameters of the current prediction unit PU in each of the angle representative modes.
  • the first direction corresponding to the PU; the angle corresponding to the first direction represents the encoding effect parameter in the mode meeting the first preset condition;
  • a second selection mode 403, configured to select a candidate direction from the candidate directions according to the first direction; the candidate directions include at least the first direction;
  • a third selection mode 404 is configured to select a candidate mode from modes provided by the preset coding standard based on modes around the candidate direction.
  • the second selection mode 403 is specifically used for:
  • a second direction corresponding to the current PU is selected from the candidate directions; the gradient strength in the second direction satisfies a second preset condition.
  • the candidate direction is selected from the candidate directions according to the relative relationship between the first direction and the second direction.
  • the second selection mode 403 is also specifically used for:
  • the current PU is divided into at least two calculation blocks; wherein one of the calculation blocks includes at least two pixel points.
  • the gradient strength of the calculation block in the alternative direction is calculated according to the pixel values of the pixel points included in each of the calculation blocks.
  • the gradient strength corresponding to the current PU in the candidate direction is calculated.
  • the corresponding candidate direction with the smallest gradient intensity is determined as the second direction.
  • the second selection mode 403 is also specifically used for:
  • n pairs of pixel point pairs are selected from the calculation block at intervals as reference pixel point pairs.
  • the difference calculation is performed based on the pixels included in the reference pixel pair.
  • the result of the difference calculation is determined as the gradient strength of the calculation block in the candidate direction.
  • the second selection mode 403 is also specifically used for:
  • the candidate direction indicated by the first direction is determined as the candidate direction.
  • the candidate directions are selected as the candidate directions.
  • the candidate direction represented by the first direction and the candidate direction represented by the second direction are determined as the candidate direction; wherein, the preset angle is an angle other than 0 degrees and 90 degrees.
  • the second selection mode 403 is also specifically used for:
  • All the candidate directions are selected and determined as the candidate directions.
  • the third selection mode 404 is specifically used for:
  • a first candidate mode is determined according to the first candidate mode, and a non-angular mode provided by the preset coding standard is determined as a second candidate mode.
  • the first candidate mode and the second candidate mode are determined as the candidate modes.
  • the third selection mode 404 is also specifically used for:
  • the first candidate mode corresponding to the first q largest rate-distortion costs is used as the second candidate mode.
  • An angle mode adjacent to both sides of the second candidate mode is determined as the first candidate mode.
  • the device 40 further includes:
  • An adding module is used for adding the angle representative mode and the first candidate mode to the candidate mode.
  • the device 40 further includes:
  • the second determination module is configured to determine the rate-distortion cost corresponding to the candidate mode.
  • a rejection module configured to reject the candidate mode if the rate-distortion cost corresponding to the candidate mode is greater than a preset rate-distortion cost threshold.
  • the first selection mode 401 is specifically used for:
  • m angle modes are selected from the angle modes provided by the preset coding standard at equal intervals in sequence according to the second preset step size.
  • the selected m angle patterns are used as the angle representative patterns.
  • the first determination mode 402 is specifically used for:
  • a rate-distortion cost for the current PU in each of the angle representation modes is calculated.
  • the angle with the smallest rate-distortion cost represents the candidate direction corresponding to the mode, and is determined as the first direction.
  • the mode selection device selects m angle representative modes from the angle modes provided by the preset coding standard, where m is less than the number of angle modes provided by the preset coding standard, and the angle representative mode is selected.
  • the direction represented by the mode is used as an alternative direction, and according to the coding effect parameters of the current prediction unit PU in each angle representative mode, the first direction corresponding to the current PU is selected from the alternative directions, and then according to the first direction, from the alternative direction Select candidate directions from among the candidate directions, and the candidate directions include at least the first direction.
  • a candidate mode is selected from the modes provided by the preset coding standard.
  • the candidate direction in which the optimal mode may be located is determined by first selecting the angle representative mode, and the candidate mode is only selected in the mode around the candidate direction, that is, the direction with a small probability of having a mode with better coding effect is excluded,
  • the candidate direction that is, the partial mode
  • the candidate direction that is, the partial mode
  • the device embodiments described above are only illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in One place, or it can be distributed over multiple network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment. Those of ordinary skill in the art can understand and implement it without creative effort.
  • an embodiment of the present disclosure further provides an electronic device, the electronic device may include: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the When the processor executes the program, each process of the above mode selection method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, details are not repeated here.
  • an embodiment of the present disclosure further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, each process of the foregoing mode selection method embodiment is implemented, and can To achieve the same technical effect, in order to avoid repetition, details are not repeated here.
  • FIG. 9 shows a schematic structural diagram of an electronic device.
  • the electronic device includes a processor 510 and a memory 520 .
  • the memory 520 may be something such as flash memory, electrically erasable programmable read-only memory, hard disk, random access memory (RAM), magnetic disk, optical disk, or read-only memory (ROM) or the like electronic storage.
  • Memory 520 has storage space 530 for program codes. These program codes can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks, portable or fixed storage units as described with reference to FIG. 10 .
  • the storage unit may have storage segments, storage spaces, etc. arranged similarly to the memory 520 in the electronic device of FIG. 9 .
  • the storage unit includes computer readable code 1031' which, when executed by a computing processing device, causes the computing processing device to perform the various steps in the methods described above.

Landscapes

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

Abstract

The present disclosure provides a mode selection method and apparatus, a computer-readable storage medium and an electronic device, belonging to the technical field of video coding. The method comprises: selecting a number m of angle representative modes from angle modes provided by a preset coding standard, wherein m is smaller than the number of the angle modes provided by the preset coding standard; taking directions represented by the angle representative modes as alternative directions, and according to coding effect parameters of a current prediction unit in the various angle representative modes, selecting from the alternative directions a first direction corresponding to the current prediction unit; then selecting a candidate direction from the alternative directions according to the first direction; and according to the candidate direction, selecting a candidate mode from the modes provided by the preset coding standard. In this way, when multiple angle modes are screened, only the modes around the candidate direction, i.e., partial modes, are used as screening bases, thus during candidate mode selection, reducing the number of the modes needing to be determined wholly to some extent, and thereby reducing calculation amount and time consumption and improving efficiency.

Description

模式选择方法、装置、计算机可读存储介质及电子设备Mode selection method, apparatus, computer-readable storage medium, and electronic device
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本公开要求在2020年07月31日提交中国专利局、申请号为202010761465.4、名称为“模式选择方法、装置、计算机可读存储介质及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本公开中。This disclosure claims the priority of a Chinese patent application with application number 202010761465.4 and entitled "Mode Selection Method, Apparatus, Computer-readable Storage Medium and Electronic Device" filed with the China Patent Office on July 31, 2020, the entire contents of which are provided by References are incorporated in this disclosure.
技术领域technical field
本公开属于视频编码技术领域,特别是涉及一种模式选择方法、装置、计算机可读存储介质及电子设备。The present disclosure belongs to the technical field of video coding, and in particular, relates to a mode selection method, an apparatus, a computer-readable storage medium, and an electronic device.
背景技术Background technique
为了提高视频传输的速度,经常会利用预设视频编码标准对视频进行编码,以减少所需传输的数据量。在使用预设编码标准进行编码时,往往会先将视频图像划分为编码树单元(coding tree unit,CTU),将CTU划分为编码单元(Coding unit,CU),CU划分为预测单元(prediction,unit,PU)。对于每个PU,需要利用预设编码标准提供的每种模式对当前PU进行遍历计算,并基于遍历计算的结果从中选择候选模式。接着根据候选模式生成候选列表,并将与当前PU相邻的已编码PU对应的最优模式也加入候选列表。最后,利用候选列表中的候选模式对当前PU进行遍历,以选择出对于当前PU而言,编码效果较好的模式,例如,最优模式,并利用该模式完成对当前PU的编码。In order to improve the speed of video transmission, the video is often encoded by using a preset video encoding standard to reduce the amount of data to be transmitted. When using the preset coding standard for coding, the video image is often divided into coding tree units (coding tree units, CTUs) first, CTUs are divided into coding units (Coding units, CUs), and CUs are divided into prediction units (prediction, unit, PU). For each PU, it is necessary to perform traversal calculation on the current PU using each mode provided by the preset coding standard, and select candidate modes from the traversal calculation result. Then, a candidate list is generated according to the candidate mode, and the optimal mode corresponding to the coded PU adjacent to the current PU is also added to the candidate list. Finally, the current PU is traversed by using the candidate modes in the candidate list to select a mode with better coding effect for the current PU, for example, the optimal mode, and use this mode to complete the coding of the current PU.
在选择候选模式的环节中,相关技术中往往是以所有模式为筛选基础,依次计算当前CU在每一种模式下的编码效果参数,例如,计算率失真代价,然后根据每一种模式对应的编码效果参数筛选候选模式。这样,在存在较多PU的情况下,或者,预设编码标注提供了多种模式的情况下,例如,HEVC标准提供两种非角度模式及33种角度模式的情况下,对每一个PU遍历计算所有模式下的编码效果参数的方式,会导致计算量较大,耗时较长,效率较低。In the process of selecting candidate modes, in the related art, all modes are often used as the screening basis, and the coding effect parameters of the current CU in each mode are calculated in turn, for example, the rate-distortion cost is calculated, and then according to the corresponding The encoding effect parameter filters candidate modes. In this way, when there are more PUs, or when the preset coding annotation provides multiple modes, for example, when the HEVC standard provides two non-angle modes and 33 angle modes, the traversal of each PU is performed. The way of calculating the encoding effect parameters in all modes will result in a large amount of calculation, long time consumption and low efficiency.
概述Overview
有鉴于此,本公开提供一种模式选择方法、装置、计算机可读存储介质及电子设备,在一定程度上解决了进行模式选择时,计算量较大,耗时较长,效率较低的问题。In view of this, the present disclosure provides a mode selection method, device, computer-readable storage medium and electronic device, which solve the problems of large amount of calculation, long time consumption and low efficiency when mode selection is performed to a certain extent .
第一方面,本公开提供了一种模式选择方法,该方法可以包括:In a first aspect, the present disclosure provides a mode selection method, which may include:
从预设编码标准提供的角度模式中,选择m个角度代表模式;所述m小 于所述预设编码标准提供的角度模式的数量;From the angle modes provided by the preset coding standard, select m angle representative modes; the m is less than the number of angle modes provided by the preset coding standard;
将所述角度代表模式表示的方向作为备选方向,并根据当前预测单元PU在各个所述角度代表模式下的编码效果参数,从所述备选方向中确定当前PU对应的第一方向;所述第一方向对应的角度代表模式下的编码效果参数满足第一预设条件;The direction represented by the angle representative mode is used as an alternative direction, and the first direction corresponding to the current PU is determined from the alternative directions according to the coding effect parameters of the current prediction unit PU in each of the angle representative modes; The encoding effect parameter in the angle representative mode corresponding to the first direction satisfies the first preset condition;
根据所述第一方向从所述备选方向中选择候选方向;所述候选方向中至少包括所述第一方向;A candidate direction is selected from the candidate directions according to the first direction; the candidate directions include at least the first direction;
基于所述候选方向周围的模式,从所述预设编码标准提供的模式中选择候选模式。Based on the patterns around the candidate direction, a candidate pattern is selected from patterns provided by the preset coding standard.
第二方面,本公开提供了一种模式选择装置,该装置可以包括:In a second aspect, the present disclosure provides a mode selection apparatus, which may include:
第一选择模式,用于从预设编码标准提供的角度模式中,选择m个角度代表模式;所述m小于所述预设编码标准提供的角度模式的数量;a first selection mode, used for selecting m angle representative modes from the angle modes provided by the preset coding standard; the m is less than the number of angle modes provided by the preset coding standard;
第一确定模式,用于将所述角度代表模式表示的方向作为备选方向,并根据当前预测单元PU在各个所述角度代表模式下的编码效果参数,从所述备选方向中确定当前PU对应的第一方向;所述第一方向对应的角度代表模式下的编码效果参数满足第一预设条件;a first determination mode, configured to use the direction represented by the angle representative mode as a candidate direction, and determine the current PU from the candidate directions according to the coding effect parameters of the current prediction unit PU in each of the angle representative modes The corresponding first direction; the angle corresponding to the first direction represents that the encoding effect parameter in the mode satisfies the first preset condition;
第二选择模式,用于根据所述第一方向从所述备选方向中选择候选方向;所述候选方向中至少包括所述第一方向;a second selection mode, configured to select a candidate direction from the candidate directions according to the first direction; the candidate directions include at least the first direction;
第三选择模式,用于基于所述候选方向周围的模式,从所述预设编码标准提供的模式中选择候选模式。The third selection mode is used to select a candidate mode from modes provided by the preset coding standard based on modes around the candidate direction.
第三方面,本公开提供了一种计算机可读存储介质,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现如第一方面所述的模式选择方法。In a third aspect, the present disclosure provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the mode selection method according to the first aspect is implemented.
第四方面,本公开提供了一种电子设备包括:处理器、存储器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现如第一方面所述的模式选择方法。In a fourth aspect, the present disclosure provides an electronic device comprising: a processor, a memory, and a computer program stored on the memory and executable on the processor, wherein the processor executes the program When implementing the mode selection method described in the first aspect.
针对相关技术,本公开具备如下优点:For the related art, the present disclosure has the following advantages:
通过从预设编码标准提供的角度模式中,选择m个角度代表模式,m小于预设编码标准提供的角度模式的数量,将角度代表模式表示的方向作为备选方向,并根据当前预测单元PU在各个角度代表模式下的编码效果参数,从备选方向中选择当前PU对应的第一方向,接着根据第一方向,从备选方向中选择候选方向,候选方向中至少包括第一方向。最后,根据候选方向,从预设编码标准提供的模式中选择候选模式。这样,通过先选择角度代表模式确定出最优模式可能在的候选方向,并仅在该候选方向周围的模式上选择候选模式,即,排除掉存在编码效果较好模式的概率较小的方向,在针对多种角度模式筛选时,仅以候选方向周围的模式,即,部分模式为筛选基础,这样, 一定程度上可以减小筛选候选模式时整体需要判断的模式数量,进而降低计算量以及耗时,提高效率。By selecting m angle representative modes from the angle modes provided by the preset coding standard, where m is less than the number of angle modes provided by the preset coding standard, the direction represented by the angle representative mode is taken as an alternative direction, and according to the current prediction unit PU For coding effect parameters in each angle representative mode, a first direction corresponding to the current PU is selected from the candidate directions, and then a candidate direction is selected from the candidate directions according to the first direction, and the candidate directions at least include the first direction. Finally, according to the candidate direction, a candidate mode is selected from the modes provided by the preset coding standard. In this way, the candidate direction in which the optimal mode may be located is determined by first selecting the angle representative mode, and the candidate mode is only selected in the mode around the candidate direction, that is, the direction with a small probability of having a mode with better coding effect is excluded, When screening for multiple angle modes, only the mode around the candidate direction, that is, the partial mode, is the basis for screening. In this way, the number of modes that need to be judged when screening the candidate mode can be reduced to a certain extent, thereby reducing the amount of calculation and consumption. , improve efficiency.
上述说明仅是本公开技术方案的概述,为了能够更清楚了解本公开的技术手段,而可依照说明书的内容予以实施,并且为了让本公开的上述和其它目的、特征和优点能够更明显易懂,以下特举本公开的具体实施方式。The above description is only an overview of the technical solutions of the present disclosure. In order to understand the technical means of the present disclosure more clearly, it can be implemented according to the contents of the description, and in order to make the above-mentioned and other purposes, features and advantages of the present disclosure more obvious and easy to understand , the following specific embodiments of the present disclosure are given.
附图简述Brief Description of Drawings
为了更清楚地说明本公开实施例或相关技术中的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the related technologies, the following briefly introduces the accompanying drawings used in the description of the embodiments or related technologies. Obviously, the drawings in the following description are the For the disclosed embodiments, for those of ordinary skill in the art, other drawings can also be obtained from these drawings without any creative effort.
图1是本公开实施例提供的一种模式示意图;FIG. 1 is a schematic diagram of a mode provided by an embodiment of the present disclosure;
图2是本公开实施例提供的一种模式选择方法的步骤流程图;2 is a flowchart of steps of a mode selection method provided by an embodiment of the present disclosure;
图3是本公开实施例提供的另一种模式示意图;3 is a schematic diagram of another mode provided by an embodiment of the present disclosure;
图4是本公开实施例提供的另一种模式选择方法的步骤流程图;4 is a flowchart of steps of another mode selection method provided by an embodiment of the present disclosure;
图5是本公开实施例提供的一种划分示意图;5 is a schematic diagram of a division provided by an embodiment of the present disclosure;
图6是本公开实施例提供的一种计算块的梯度方向示意图;6 is a schematic diagram of a gradient direction of a computing block provided by an embodiment of the present disclosure;
图7是本公开实施例提供的一种PU的梯度方向示意图;FIG. 7 is a schematic diagram of a gradient direction of a PU provided by an embodiment of the present disclosure;
图8是本公开实施例提供的一种模式选择装置的框图;8 is a block diagram of a mode selection apparatus provided by an embodiment of the present disclosure;
图9是本公开实施例提供的一种电子设备的结构示意图;并且FIG. 9 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure; and
图10示意性地示出了用于保持或者携带实现根据本公开的方法的程序代码的存储单元。Figure 10 schematically shows a memory unit for holding or carrying program code implementing the method according to the present disclosure.
详细描述A detailed description
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。此外,在不冲突的情况下,本公开中的实施例及实施例中的特征可以相互组合。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Furthermore, the embodiments of this disclosure and the features of the embodiments may be combined with each other without conflict.
首先对本公开实施例中涉及的应用场景进行说明。具体的,在信息大爆炸时代,数字视频作为人们日常生活中获取信息的重要媒介,在网络社会中扮演了十分重要的角色。然而视频信息所携带的巨大的信息量对视频数据的传输造成了很大的困难。根据现代编码的理论和方法,由于视频数据中包含大量的冗余信息,对视频数据进行编码压缩,去除其中的冗余信息,就可以减少数据量,从而实现对视频信息的有效获取和利用。First, the application scenarios involved in the embodiments of the present disclosure are described. Specifically, in the era of information explosion, digital video, as an important medium for people to obtain information in daily life, plays a very important role in the network society. However, the huge amount of information carried by the video information causes great difficulties in the transmission of video data. According to modern coding theories and methods, since the video data contains a lot of redundant information, the video data can be encoded and compressed to remove the redundant information to reduce the amount of data, thereby realizing the effective acquisition and utilization of video information.
为了实现对视频数据的编码,诞生了多种视频编码标准。例如,H.264视频编码标准、高效视频编码(High Efficiency Video Coding,HEVC)标准, 等等。一个视频编码标准可以提供多种编码预测模式。使用每种模式对视频图像中的同一PU进行编码时,图像失真度和编码码率会不同。进一步地,由于不同视频的不同视频图像所包含的图像内容不同,受到内容差异的影响,使用同一模式对不同PU进行编码时,图像失真度和编码码率也会不同。因为,为了平衡编码时的图像失真度和编码码率,在对视频进行编码时,就需要选择对于当前PU而言,编码效果较好的模式,例如,选择出最优模式,然后利用该模式对当前PU进行编码。In order to realize the encoding of video data, a variety of video encoding standards were born. For example, the H.264 video coding standard, the High Efficiency Video Coding (HEVC) standard, and the like. A video coding standard can provide multiple coding prediction modes. When using each mode to encode the same PU in a video image, the degree of image distortion and encoding bit rate will be different. Further, because different video images of different videos contain different image contents and are affected by the differences in contents, when different PUs are encoded using the same mode, the image distortion degree and encoding bit rate will also be different. Because, in order to balance the image distortion degree and the encoding bit rate during encoding, when encoding the video, it is necessary to select the mode with better encoding effect for the current PU, for example, select the optimal mode, and then use the mode Encode the current PU.
以采用HEVC标准为例,HEVC标准作为常用的新一代视频编码标准,其目的是解决人们对视觉和听觉质量日益增加的需求。它所提供的帧内预测技术就是为了消除视频数据中的空间相关性而设计的。根据空间上相隔越近的像素点之间的相关性越强的原理,它可以根据像素点之间的相关性,使用相邻像素加权预测当前像素的原理进行编码,这样,只需要对预测残差进行变换量化,所需传输的数据量就可以较大的减少。而为了达到更好的编码性能,HEVC标准提供了大量的模式,具体的,HEVC标准提供的模式包含了两种非角度模式以33种角度模式。示例的,图1是本公开实施例提供的一种模式示意图,如图1所示,“0Intra_Planar”以及“1Intra_DC”分别表示两种非角度模式:planar模式及DC模式,2~34分别表示33中角度模式。在采用HEVC标准进行视频编码的编码场景中,就需要针对每个PU,从这35种模式中先选择出候选模式,然后基于候选模式选择出最优模式。Taking the adoption of the HEVC standard as an example, the HEVC standard is a commonly used new-generation video coding standard, and its purpose is to address people's increasing demands for visual and auditory quality. The intra-frame prediction technology it provides is designed to eliminate spatial correlation in video data. According to the principle that the spatially closer pixels have a stronger correlation, it can use the principle of weighting adjacent pixels to predict the current pixel according to the correlation between the pixels. In this way, only the prediction residual needs to be If the difference is transformed and quantized, the amount of data to be transmitted can be greatly reduced. In order to achieve better coding performance, the HEVC standard provides a large number of modes. Specifically, the modes provided by the HEVC standard include two non-angle modes and 33 angle modes. By way of example, FIG. 1 is a schematic diagram of a mode provided by an embodiment of the present disclosure. As shown in FIG. 1 , “0Intra_Planar” and “1Intra_DC” respectively represent two non-angular modes: planar mode and DC mode, and 2 to 34 respectively represent 33 Medium angle mode. In an encoding scenario where the HEVC standard is used for video encoding, it is necessary to select a candidate mode from the 35 modes for each PU, and then select the optimal mode based on the candidate mode.
进一步地,相关技术中往往需要遍历这35种模式,计算当前PU在每种模式下的率失真代价,然后根据每种模式对应的率失真代价,选择出部分模式作为候选模式,例如,选择出前n个模式作为候选模式。由于使用HEVC标准进行视频编码时,往往是采用四叉树结构的划分方式,对视频图像进行划分,以划分出多个PU。这种划分方式中,一帧视频图像中往往会划分多大量的PU。如果采用这种方式筛选候选模式,就会导致编码过程中,需要对大量的PU均遍历35种模式,产生较大的计算量以及较长耗时,使得编码器负荷较重且长时间被占用,进而对编码器的性能造成较大限制。Further, in the related art, it is often necessary to traverse these 35 modes, calculate the rate-distortion cost of the current PU in each mode, and then select some modes as candidate modes according to the rate-distortion cost corresponding to each mode. n patterns as candidate patterns. Since the HEVC standard is used for video coding, a quad-tree structure is often used to divide the video image to divide a plurality of PUs. In this division method, a large number of PUs are often divided into a frame of video image. If the candidate modes are screened in this way, it will lead to the need to traverse 35 modes for a large number of PUs in the encoding process, resulting in a large amount of calculation and a long time-consuming, making the encoder load heavier and occupied for a long time. , which further limits the performance of the encoder.
为此本公开实施例提出了一种模式选择方法,以简化筛选。To this end, an embodiment of the present disclosure proposes a mode selection method to simplify screening.
图2是本公开实施例提供的一种模式选择方法的步骤流程图,如图2所示,该方法可以包括:FIG. 2 is a flowchart of steps of a mode selection method provided by an embodiment of the present disclosure. As shown in FIG. 2 , the method may include:
步骤201、从预设编码标准提供的角度模式中,选择m个角度代表模式;所述m小于所述预设编码标准提供的角度模式的数量。Step 201: From the angle modes provided by the preset coding standard, select m angle representative modes; the m is less than the number of angle modes provided by the preset coding standard.
本公开实施例中,预设编码标准可以是用于对待编码视频进行编码的标准。具体的,预设编码标准可以是根据实际需求选定的,例如,预设编码标准可以为HEVC标准。In this embodiment of the present disclosure, the preset encoding standard may be a standard for encoding the video to be encoded. Specifically, the preset coding standard may be selected according to actual requirements, for example, the preset coding standard may be the HEVC standard.
进一步地,由于视频编码提供的模式中往往会存在大量的角度模式,且 预设编码标准提供的角度模式中,不同角度模式表示的角度不同,但是角度近似的角度模式所指示的方向大体近似。例如,从图1可以看出,指示水平方向的角度模式11,相较于其两侧邻近的其他角度模式,例如角度模式10,角度模式12而言,角度模式11所指示的水平方向相较于角度模式10、12所指示的水平方向更加精准,但是三者大体也都指向水平方向。再例如,指示竖直方向的角度模式26,相较于其两侧邻近的其他角度模式,例如角度模式25,角度模式27而言,角度模式26所指示的竖直方向相较于角度模式25、27所指示的竖直方向更加精准,但是三者大体也都指向水平方向。因此,本步骤中,可以先选择出部分角度模式作为角度代表模式,一个角度代表模式代表该角度可以代表模式所指示方向周围的其他模式,即,表示一个角度模式区间,进而实现利用这m个角度代表模式代表该预设编码标准提供的角度模式。Further, since there are often a large number of angle modes in the modes provided by video coding, and in the angle modes provided by the preset coding standard, the angles represented by different angle modes are different, but the directions indicated by the angle modes with approximate angles are generally similar. For example, as can be seen from FIG. 1 , the angle pattern 11 indicating the horizontal direction is compared with other angle patterns adjacent to both sides thereof, such as the angle pattern 10 and the angle pattern 12 , the horizontal direction indicated by the angle pattern 11 is relatively The horizontal directions indicated by the angle patterns 10 and 12 are more precise, but all three generally point to the horizontal direction. For another example, the angle pattern 26 indicating the vertical direction is compared with other angle patterns adjacent to both sides thereof, such as the angle pattern 25 and the angle pattern 27, the vertical direction indicated by the angle pattern 26 is compared with that of the angle pattern 25. The vertical direction indicated by , 27 is more accurate, but the three generally point to the horizontal direction. Therefore, in this step, a part of the angle pattern can be selected as the angle representative pattern first, and an angle representative pattern represents that the angle can represent other patterns around the direction indicated by the pattern, that is, represents an angle pattern interval, and then realizes the use of these m The angle representative mode represents the angle mode provided by the preset coding standard.
其中,m的具体数值可以是根据实际情况设定。例如,由于m越大,选出的角度代表模式少,后续所需处理的模式相对就会越少,即,计算量会越少,但是相应地,角度代表模式的代表性会越弱,筛选精度会越小。反之,m越小,选出的角度代表模式多,后续所需处理的模式相对就会越多,即,计算量会越多,但是相应地,角度代表模式的代表性会越强,筛选精度会越高。因此,本公开实施例中可以根据编码器的处理能力以及对筛选精度的要求,选择相匹配的数值作为m。进一步地,由于m小于预设编码标准提供的角度模式的数量,这样一定程度上可以确保通过选择部分角度模式作为角度代表模式,来确定候选模式的方式,所带来的计算量较小,耗时较小,进而一定程度上提高计算效率。Wherein, the specific value of m can be set according to the actual situation. For example, since the larger m is, the less representative modes of angles are selected, and the fewer modes that need to be processed subsequently, that is, the less computation is required, but correspondingly, the representativeness of the representative modes of angles will be weaker, and the screening The precision will be less. Conversely, the smaller m is, the more angle representative modes are selected, and the more modes that need to be processed subsequently, that is, the more calculation amount will be, but correspondingly, the representativeness of the angle representative mode will be stronger, and the screening accuracy will be stronger. will be higher. Therefore, in the embodiment of the present disclosure, a matching value may be selected as m according to the processing capability of the encoder and the requirement for the screening accuracy. Further, since m is less than the number of angle modes provided by the preset coding standard, it can be ensured to a certain extent that the mode of determining the candidate mode by selecting part of the angle modes as the angle representative mode results in a small amount of calculation and consumes less energy. The time is small, and the calculation efficiency is improved to a certain extent.
步骤202、将所述角度代表模式表示的方向作为备选方向,并根据当前预测单元PU在各个所述角度代表模式下的编码效果参数,从所述备选方向中确定当前PU对应的第一方向;所述第一方向对应的角度代表模式下的编码效果参数满足第一预设条件。Step 202: Use the direction indicated by the angle representative mode as an alternative direction, and determine the first corresponding to the current PU from the alternative directions according to the coding effect parameters of the current prediction unit PU in each of the angle representative modes. direction; the angle corresponding to the first direction represents that the encoding effect parameter in the mode satisfies the first preset condition.
本公开实施例中,可以将一个角度代表模式表示的方向作为一个备选方向,进而得到m个备选方向。示例的,假设选择了4个角度代表模式:10,26,2,18,它们各自表示的方向可以分别为:水平方向、垂直方向、左下方向、左上方向。那么相应地,可以将这四个方向,确定为备选方向。需要说明的是,每个角度代表模式表示的方向可以为相对的方向,在不同表示形式的模式中,同一角度代表模式对应的方向可以不同,角度代表模式表示的方向也可以为它反向延伸的方向。但各个角度代表模式表示的方向的相对关系是确定。示例的,图3是本公开实施例提供的另一种模式示意图,如图3所示,角度代表模式18此时对应的方向为右下方向,即,可以将18表示的方向理解为右下方向。In this embodiment of the present disclosure, an angle representing the direction represented by the pattern may be used as a candidate direction, and then m candidate directions are obtained. As an example, it is assumed that 4 angle representation modes are selected: 10, 26, 2, and 18, and their respective directions may be: horizontal direction, vertical direction, lower-left direction, and upper-left direction. Then correspondingly, these four directions can be determined as candidate directions. It should be noted that the direction represented by each angle represented by the mode can be a relative direction. In modes with different representations, the direction corresponding to the same angle represented by the mode can be different, and the direction represented by the angle represented by the mode can also be extended in the opposite direction. direction. But the relative relationship of the directions represented by the various angles representing the mode is determined. For example, FIG. 3 is a schematic diagram of another mode provided by an embodiment of the present disclosure. As shown in FIG. 3 , the direction corresponding to the angle representative mode 18 at this time is the lower right direction, that is, the direction represented by 18 can be understood as the lower right direction direction.
进一步地,当前PU在角度代表模式下的编码效果参数可以是能够反映出利用该角度代表模式对当前PU进行编码,图像失真程度及编码码率大小的参数。由于视频编码的主要目的往往是保证一定视频质量的条件下尽可能的减小码率,或保证一定码率的条件下尽可能的减小失真。因此,可以采用率失真代价作为编码效果参数,进而体现利用该角度代表模式对当前PU进行编码时的效果。Further, the encoding effect parameter of the current PU in the angle representative mode may be a parameter that can reflect the degree of image distortion and the size of the encoding bit rate for encoding the current PU using the angle representative mode. Because the main purpose of video coding is often to reduce the bit rate as much as possible under the condition of ensuring a certain video quality, or reduce the distortion as much as possible under the condition of ensuring a certain bit rate. Therefore, the rate-distortion cost can be used as a coding effect parameter, thereby reflecting the effect of coding the current PU by using the angle representative mode.
第一方向可以是对应的角度代表模式下的编码效果参数较好的备选方向。第一预设条件可以是根据实际情况设定,只要确保利用满足该第一预设条件的编码效果参数对应的角度代表模式,对当前PU进行编码时的效果较好即可。示例的,该第一预设条件可以为编码效果参数小于预设参数阈值,或者是,为编码效果参数表示的编码效果最好。以编码效果参数为率失真代价参数为例,由于率失真代价越小,表示编码性能越好,因此,可以将对应的率失真代价小于预设参数阈值的备选方向确定为第一方向,或者是将对应的率失真代价最小的备选方向确定为第一方向,即采用备选方向中的最小率失真代价方向作为第一方向。The first direction may be an alternative direction with better coding effect parameters in the corresponding angle representative mode. The first preset condition may be set according to the actual situation, as long as it is ensured that the encoding effect of the current PU is better by using the angle representative mode corresponding to the encoding effect parameter that satisfies the first preset condition. For example, the first preset condition may be that the encoding effect parameter is smaller than the preset parameter threshold, or the encoding effect represented by the encoding effect parameter is the best. Taking the coding effect parameter as the rate-distortion cost parameter as an example, since the smaller the rate-distortion cost, the better the coding performance, therefore, the candidate direction whose corresponding rate-distortion cost is less than the preset parameter threshold can be determined as the first direction, or is to determine the corresponding candidate direction with the smallest rate-distortion cost as the first direction, that is, the direction with the smallest rate-distortion cost in the candidate directions is used as the first direction.
步骤203、根据所述第一方向从所述备选方向中选择候选方向;所述候选方向中至少包括所述第一方向。Step 203: Select a candidate direction from the candidate directions according to the first direction; the candidate directions include at least the first direction.
本公开实施例中,由于第一方向对应的角度代表模式下的编码效果参数满足第一预设条件,即,利用第一方向对应的角度代表模式对当前PU进行编码时,编码效果较好。因此,可以认为该第一方向周围的模式中很有可能存在对于当前PU而言,编码效果较好的模式。相应地,可以根据第一方向从备选方向中选择候选方向。具体的,可以根据第一方向选择周围的模式中存在编码效果较好的模式的概率较大的方向作为候选方向。In the embodiment of the present disclosure, since the encoding effect parameter in the angle representative mode corresponding to the first direction satisfies the first preset condition, that is, when the current PU is encoded using the angle representative mode corresponding to the first direction, the encoding effect is better. Therefore, it can be considered that a mode with better coding effect for the current PU is likely to exist in the modes around the first direction. Accordingly, the candidate direction may be selected from the candidate directions according to the first direction. Specifically, according to the first direction, a direction with a higher probability that a mode with better coding effect exists among the surrounding modes may be selected as a candidate direction.
步骤204、基于所述候选方向周围的模式,从所述预设编码标准提供的模式中选择候选模式。Step 204: Based on the patterns around the candidate direction, select a candidate pattern from patterns provided by the preset coding standard.
本公开实施例中,由于候选方向是根据第一方向确定且至少包括第一方向,因此可以认为候选方向周围的模式中很有可能存在对于当前PU而言,编码效果较好的模式。相应地,可以基于候选方向周围的模式,从预设编码标准提供的模式中选择候选模式。其中,该候选方向周围的角度模式可以是预设编码标准提供的部分角度模式,即候选方向周围的角度模式的数量小于预设编码标准提供的角度模式的数量。这样,仅需对部分角度模式进行计算,即可确定出角度模式中包含的候选模式,进而一定程度上可以减少计算量。In the embodiment of the present disclosure, since the candidate direction is determined according to the first direction and includes at least the first direction, it can be considered that there is a mode with better coding effect for the current PU in the modes around the candidate direction. Accordingly, the candidate mode may be selected from the modes provided by the preset coding standard based on the modes around the candidate direction. The angle patterns around the candidate direction may be partial angle patterns provided by the preset coding standard, that is, the number of angle patterns around the candidate direction is smaller than the number of angle patterns provided by the preset coding standard. In this way, the candidate modes included in the angle modes can be determined only by calculating part of the angle modes, thereby reducing the amount of calculation to a certain extent.
本公开实施例提供的模式选择方法,通过从预设编码标准提供的角度模式中,选择m个角度代表模式,m小于预设编码标准提供的角度模式的数量,将角度代表模式表示的方向作为备选方向,并根据当前预测单元PU在各个角度代表模式下的编码效果参数,从备选方向中选择当前PU对应的第一方向, 接着根据第一方向,从备选方向中选择候选方向,候选方向中至少包括第一方向。最后,根据候选方向,从预设编码标准提供的模式中选择候选模式。这样,通过先选择角度代表模式确定出最优模式可能在的候选方向,并仅在该候选方向周围的模式上选择候选模式,即,排除掉存在编码效果较好模式的概率较小的方向,在针对多种角度模式筛选时,仅以候选方向周围的模式,即,部分模式为筛选基础,这样,一定程度上可以减小筛选候选模式时整体需要判断的模式数量,进而降低计算量以及耗时,提高效率。The mode selection method provided by the embodiment of the present disclosure selects m angle representative modes from the angle modes provided by the preset coding standard, where m is smaller than the number of angle modes provided by the preset coding standard, and takes the direction represented by the angle representative mode as an alternative direction, and according to the encoding effect parameters of the current prediction unit PU in each angle representative mode, select a first direction corresponding to the current PU from the alternative directions, and then select a candidate direction from the alternative directions according to the first direction, The candidate directions include at least the first direction. Finally, according to the candidate direction, a candidate mode is selected from the modes provided by the preset coding standard. In this way, the candidate direction in which the optimal mode may be located is determined by first selecting the angle representative mode, and the candidate mode is only selected in the mode around the candidate direction, that is, the direction with a small probability of having a mode with better coding effect is excluded, When screening for multiple angle modes, only the modes around the candidate directions, that is, some modes, are used as the basis for screening. In this way, the number of modes that need to be judged when screening candidate modes can be reduced to a certain extent, thereby reducing the amount of calculation and consumption. , improve efficiency.
图4是本公开实施例提供的另一种模式选择方法的步骤流程图,如图4所示,该方法可以包括:FIG. 4 is a flowchart of steps of another mode selection method provided by an embodiment of the present disclosure. As shown in FIG. 4 , the method may include:
步骤301、从预设编码标准提供的角度模式中,选择m个角度代表模式;所述m小于所述预设编码标准提供的角度模式的数量。Step 301: From the angle modes provided by the preset coding standard, select m angle representative modes; the m is less than the number of angle modes provided by the preset coding standard.
具体的,本步骤可以通过下述操作实现:以预设角度模式为起点,按照第二预设步长依次从所述预设编码标准提供的角度模式中等间距选择m个角度模式;将所选择的所述m个角度模式作为所述角度代表模式。Specifically, this step can be implemented by the following operations: starting from the preset angle mode, selecting m angle modes at equal intervals from the angle modes provided by the preset coding standard in sequence according to the second preset step size; The m angle patterns of are taken as the angle representative patterns.
在进行选择时,可以抽取起点处的角度模式,然后从抽取出来的第一个角度模式处出发,抽取经过第二预设步长之后所到达处的角度模式,接着从当前抽取的角度模式出发,抽取经过第二预设步长之后所到达处的角度模式,以此类推,直至抽取够m个角度模式位置。其中,预设角度模式以及第二预设步长可以是根据实际情况预先设定的。示例的,可以将角度模式2作为预设角度模式,或者是将角度模式34作为预设角度模式,设置第二预设步长为8。以预设角度模式为角度模式2,第二预设步长为8,m为4为例,可以先抽取角度模式2,然后从角度模式2出发,抽取经过8个步长之后所到达处的角度模式10,接着,从角度模式10出发,抽取经过8个步长之后所到达处的角度模式18,从角度模式18出发,抽取经过8个步长之后所到达处的角度模式26,得到四个角度模式:角度模式2、角度模式10、角度模式18、角度模式26。最后,可以将这四个角度模式确定为角度代表模式。本公开实施例中,通过第二预设步长等间距的进行抽取,这样,可以确保最后得到的角度代表模式均匀的分布在角度模式中,进而可以确保每个角度代表模式能够均匀代表其周围的角度模式,提高基于角度代表模式进行选择的可靠性。When making a selection, the angle pattern at the starting point can be extracted, and then starting from the first extracted angle pattern, the angle pattern reached after the second preset step is extracted, and then starting from the currently extracted angle pattern , extracting the angle pattern reached after the second preset step, and so on, until enough m angle pattern positions are extracted. The preset angle mode and the second preset step size may be preset according to actual conditions. For example, the angle mode 2 may be used as the preset angle mode, or the angle mode 34 may be used as the preset angle mode, and the second preset step size is set to 8. Take the preset angle mode as angle mode 2, the second preset step size is 8, and m is 4 as an example, you can first extract angle mode 2, and then start from angle mode 2, extract the position reached after 8 steps. The angle pattern 10, then, starting from the angle pattern 10, extract the angle pattern 18 where it reaches after 8 steps, and starting from the angle pattern 18, extract the angle pattern 26 where it reaches after 8 steps, and obtain four Angle mode: angle mode 2, angle mode 10, angle mode 18, angle mode 26. Finally, the four angle patterns can be determined as angle representative patterns. In the embodiment of the present disclosure, extraction is performed at equal intervals by the second preset step size, so that it can be ensured that the finally obtained angle representative patterns are evenly distributed in the angle patterns, thereby ensuring that each angle representative pattern can evenly represent its surroundings. angle mode, improving the reliability of selection based on the angle representative mode.
步骤302、将所述角度代表模式表示的方向作为备选方向,并计算所述当前PU在各个所述角度代表模式下的率失真代价。Step 302: Use the direction represented by the angle representative mode as a candidate direction, and calculate the rate-distortion cost of the current PU in each of the angle representative modes.
本步骤中,针对每个角度代表模式,可以分别执行下述操作来实现计算当前PU在各个角度代表模式下的率失真代价:In this step, for each angle representative mode, the following operations may be performed respectively to calculate the rate-distortion cost of the current PU in each angle representative mode:
使用该角度代表模式定义的编码参数,计算对当前PU的残差进行哈德曼变换后的系数绝对和(Sum of Absolute Transformed Difference,SATD)以及相应的编码比特率(R),以SATD表示当前PU在该角度代表模式下的失真 程度D。然后将两者带入下述公式,得到当前PU在该角度代表模式下的率失真代价(J(mode)):Use the coding parameters defined by the angle to represent the mode to calculate the absolute sum of coefficients (Sum of Absolute Transformed Difference, SATD) and the corresponding coding bit rate (R) after the Hardman transform of the residual of the current PU, and use SATD to represent the current The degree of distortion D of the PU at this angle represents the mode. Then bring the two into the following formula to get the rate-distortion cost (J(mode)) of the current PU in the representative mode of this angle:
J(mode)=SATD+λ*R;J(mode)=SATD+λ*R;
其中,λ为预设系数。Among them, λ is a preset coefficient.
由于使用模式进行编码的计算量较大,因此,相较于直接使用该角度代表模式对当前PU进行编码,来获取当前PU在该角度代表模式下的失真程度D,结合该失真程度D计算当前PU在该角度代表模式下的率失真代价的方式。本步骤中,以SATD表示D,使得无需进行编码即可计算出当前PU在该角度代表模式下的率失真代价,因此,一定程度上可以减小率失真代价的计算代价,提高率失真代价的计算效率。当然,也可以直接使用失真程度D进行计算,或者是使用其他参数表示D参与计算,例如,使用绝对误差和(Sum of Absolute Difference,SAD)、差值的平方和(Sum of Squared Difference,SSD),等等,本公开实施例对此不做限定。Since the amount of computation for encoding using the mode is relatively large, compared to directly using the angle representative mode to encode the current PU, the distortion degree D of the current PU in the angle representative mode is obtained, and the current PU is calculated in combination with the distortion degree D. The way the PU represents the rate-distortion penalty in the mode at this angle. In this step, D is represented by SATD, so that the rate-distortion cost of the current PU in this angle representative mode can be calculated without encoding. Therefore, the calculation cost of the rate-distortion cost can be reduced to a certain extent, and the rate-distortion cost of the rate-distortion cost can be improved to a certain extent. Computational efficiency. Of course, the degree of distortion D can also be used directly for calculation, or other parameters can be used to indicate that D participates in the calculation, for example, using the sum of absolute error (Sum of Absolute Difference, SAD), the sum of squared differences (Sum of Squared Difference, SSD) , etc., which are not limited in the embodiments of the present disclosure.
步骤303、将率失真代价最小的角度代表模式对应的备选方向,确定为所述第一方向。Step 303: Determine the candidate direction corresponding to the angle representative mode with the smallest rate-distortion cost as the first direction.
本步骤中,可以将每个角度代表模式对应的率失真代价的大小进行比对,然后选择出数值最小的率失真代价,接着,将该最小的率失真代价对应的角度代表模式对应的备选方向,确定为第一方向。示例的,假设最小的率失真代价对应的角度代表模式对应的备选方向为水平方向,那么可以将水平方向确定为第一方向。In this step, the magnitude of the rate-distortion cost corresponding to each angle representative mode can be compared, and then the rate-distortion cost with the smallest value is selected. Then, the angle corresponding to the minimum rate-distortion cost is an alternative corresponding to the mode representative mode. The direction is determined as the first direction. For example, assuming that the candidate direction corresponding to the angle representative mode corresponding to the minimum rate-distortion cost is the horizontal direction, the horizontal direction may be determined as the first direction.
本公开实施例中,通过选择率失真代价最小的角度代表模式对应的备选方向作为第一方向,即,选择最小率失真代价方向,可以使得选择的第一方向是对当前PU的编码效果最好的方向,进而可以确保后续步骤中基于该第一方向选择的候选方向的可靠性。In the embodiment of the present disclosure, by selecting the candidate direction corresponding to the angle representative mode with the smallest rate-distortion cost as the first direction, that is, selecting the direction with the smallest rate-distortion cost, the selected first direction can be the one with the most encoding effect on the current PU. A good direction can further ensure the reliability of the candidate direction selected based on the first direction in the subsequent steps.
步骤304、根据所述当前PU在各个所述备选方向上的梯度强度,从所述备选方向中选择当前PU对应的第二方向;所述第二方向上的梯度强度满足第二预设条件。Step 304: According to the gradient strength of the current PU in each of the candidate directions, select a second direction corresponding to the current PU from the candidate directions; the gradient strength in the second direction satisfies the second preset condition.
本步骤中,梯度可以是一个具有大小和方向的矢量,梯度的方向可以是指示像素值变化的方向,即,可以表征图像的纹理方向。大小可以是梯度强度的大小,它可以表征像素点的像素值在该方向上发生变化的快慢程度。备选方向上的梯度强度可以表征梯度的大小,即,可以用于表征当前PU中像素点的像素值在该备选方向上发生变化的快慢程度。梯度强度越小,快慢程度越小即像素点的像素值在该备选方向上越缓慢变化。其中,像素值在该备选方向上发生变化的快慢程度,可以体现当前PU中的图像纹理在该备选方向上的纹理性。变化的越慢,纹理性越强。纹理性越强,当前PU中的图像纹理在该方向上越规律,反之,纹理性越弱,当前PU中的图像纹理在该方向上越杂 乱。In this step, the gradient may be a vector with magnitude and direction, and the direction of the gradient may be the direction indicating the change of the pixel value, that is, the direction of the texture of the image may be represented. The size can be the size of the gradient strength, which can characterize how fast the pixel value of the pixel changes in this direction. The gradient strength in the alternative direction can represent the magnitude of the gradient, that is, it can be used to represent how fast the pixel value of the pixel point in the current PU changes in the alternative direction. The smaller the gradient strength is, the smaller the speed is, that is, the slower the pixel value of the pixel point changes in the alternative direction. Wherein, the degree of change of the pixel value in the alternative direction may reflect the texture of the image texture in the current PU in the alternative direction. The slower the change, the stronger the texture. The stronger the texture is, the more regular the image texture in the current PU is in this direction, on the contrary, the weaker the texture is, the more chaotic the image texture in the current PU is in this direction.
进一步地,第二方向可以是对应的梯度强度较小的备选方向,即,变化较为缓慢,图像纹理的纹理性较强的备选方向。第二预设条件可以是根据实际情况设定,只要确保满足该第二预设条件的方向上的像素值的变化较为缓慢即可。示例的,该第二预设条件可以为梯度强度小于预设梯度阈值,或者是,梯度强度最小,即采用备选方向中的最小梯度方向作为第二方向。Further, the second direction may be a corresponding candidate direction with a smaller gradient intensity, that is, a candidate direction with relatively slow change and strong texture of the image texture. The second preset condition may be set according to the actual situation, as long as it is ensured that the change of the pixel value in the direction satisfying the second preset condition is relatively slow. For example, the second preset condition may be that the gradient strength is smaller than the preset gradient threshold, or the gradient strength is the smallest, that is, the smallest gradient direction among the alternative directions is used as the second direction.
具体的,本步骤中可以通过下述步骤3041~步骤3044实现:Specifically, this step can be implemented through the following steps 3041 to 3044:
步骤3041、将所述当前PU划分为至少两个计算块;其中,一个所述计算块包含至少两个像素点。Step 3041: Divide the current PU into at least two calculation blocks, wherein one of the calculation blocks includes at least two pixels.
本步骤中,计算块中包含的像素点的个数可以是根据备选方向设定的,示例的,在备选方向为一个的情况下,设置个数不小于2,在备选方向为两个的情况下,设置个数不小于3,在备选方向为3个以上的情况下,设置个数不小于4,计算块的形状可以为正方形,长方形,等等,本公开实施例对此不做限定。具体的,在划分时,可以从预设位置开始,例如,从当前PU的左上角开始,依次选择至少两个像素点作为一个计算块,进而得到多个计算块。示例的,以当前PU为一个8*8的区域为例,图5是本公开实施例提供的一种划分示意图,如图5所示,可以将每16个像素组成的正方向区域划分为一个计算块,进而得到4个计算块,其中,这4个计算块分别为:斜线覆盖的4*4像素块、黑色点覆盖的4*4像素块、横线覆盖的4*4像素块以及竖线覆盖的4*4像素块。需要说明的是,划分时,可以控制划分得到的计算块之间不存在重合部分。这样,相较于采用四叉树结构进行划分,导致出现重合部分的方式,本公开实施例中可以避免由于存在重复部分,导致重复计算的问题。In this step, the number of pixels included in the calculation block may be set according to the candidate direction. For example, in the case of one candidate direction, the set number is not less than 2, and if the candidate direction is two In the case that there are more than 3 alternative directions, the set number is not less than 3. In the case of more than 3 alternative directions, the set number is not less than 4. The shape of the calculation block may be a square, a rectangle, or the like. Not limited. Specifically, when dividing, starting from a preset position, for example, starting from the upper left corner of the current PU, at least two pixels are sequentially selected as a calculation block, and then multiple calculation blocks are obtained. For example, taking the current PU as an 8*8 area as an example, FIG. 5 is a schematic diagram of a division provided by an embodiment of the present disclosure. As shown in FIG. 5 , the forward direction area composed of every 16 pixels can be divided into one Calculation block, and then 4 calculation blocks are obtained, wherein the 4 calculation blocks are: 4*4 pixel blocks covered by slashes, 4*4 pixel blocks covered by black dots, 4*4 pixel blocks covered by horizontal lines and A 4*4 pixel block covered by vertical lines. It should be noted that, during division, it can be controlled that there is no overlap between the calculation blocks obtained by division. In this way, compared with the method of using the quad-tree structure for division, resulting in the occurrence of overlapping parts, the embodiment of the present disclosure can avoid the problem of repeated calculation due to the existence of repeated parts.
步骤3042、对于任一所述备选方向,根据各个所述计算块中包含的像素点的像素值,计算所述计算块在所述备选方向上的梯度强度。Step 3042: For any of the candidate directions, calculate the gradient strength of the calculation block in the candidate direction according to the pixel values of the pixel points included in each of the calculation blocks.
具体的,计算计算块在所述备选方向上的梯度强度就是以备选方向作为梯度方向,计算该计算块在该梯度方向上的梯度强度。对于任一计算块,可以通过下述操作实现计算该计算块在备选方向上的梯度强度:按照所述备选方向,从所述计算块中间隔选择n对像素点对,作为参考像素点对;基于所述参考像素点对中包含的像素点进行差分计算;将所述差分计算的结果,确定为所述计算块在所述备选方向上的梯度强度。Specifically, calculating the gradient strength of the calculation block in the candidate direction is to use the candidate direction as the gradient direction, and calculate the gradient strength of the calculation block in the gradient direction. For any calculation block, the gradient strength of the calculation block in the alternative direction can be calculated by the following operations: according to the alternative direction, n pairs of pixel points are selected at intervals from the calculation block as reference pixel points pair; perform differential calculation based on the pixel points included in the reference pixel point pair; determine the result of the differential calculation as the gradient strength of the calculation block in the candidate direction.
本步骤中,n可以是根据实际情况设定的。n越大,选择的参考像素点对越多,相应地,基于这些参考像素点对计算出来的计算块的梯度强度越精确。具体的,在选择参考像素点对时,可以在该备选方向上间隔选择不相邻的两个像素点组成一个参考像素点对。其中,像素点不相邻可以指的是在上下左右不相邻,即,确保参考像素点对中不存在互为4邻域像素的像素点,也可以指的是在上下左右、左上左下及右上右下不相邻,即,确保参考像素点对 中不存在互为8邻域像素的像素点。由于相近像素点之间存在相似性,因此,相较于直接使用相邻像素点进行计算的方式,本公开实施例中,通过使用间隔选择的像素点组成参考像素点对,一定程度上可以减少这种相似性带来的干扰,使得该梯度强度能够更好的反应在该备选方向上的纹理走向,更准确的刻画纹理,进而可以提高计算得到的梯度强度对该计算块的纹理性的表示精度。In this step, n may be set according to the actual situation. The larger n is, the more reference pixel pairs are selected, and accordingly, the more accurate the gradient intensity of the calculation block calculated based on these reference pixel pairs is. Specifically, when selecting a reference pixel pair, two non-adjacent pixels may be selected at intervals in the alternative direction to form a reference pixel pair. Among them, the non-adjacent pixels may refer to the non-adjacent up, down, left and right, that is, to ensure that there are no pixels in the reference pixel pair that are 4 adjacent pixels to each other. The upper right and lower right are not adjacent, that is, it is ensured that there are no pixels that are 8 neighboring pixels to each other in the reference pixel pair. Due to the similarity between adjacent pixels, compared with the method of directly using adjacent pixels for calculation, in the embodiment of the present disclosure, by using pixels selected at intervals to form reference pixel pairs, it is possible to reduce the number of pixels to a certain extent. The interference caused by this similarity enables the gradient strength to better reflect the texture trend in the alternative direction, and to describe the texture more accurately, which in turn can improve the effect of the calculated gradient strength on the texture of the calculation block. Indicates precision.
接着,基于参考像素点对进行差分计算。其中,差分又名差分函数或差分运算,差分的结果可以反映离散量之间的一种变化。具体的,计算时,可以计算每个参考像素点对中两个像素点的像素值差值的绝对值,然后计算所有绝对值之和,得到差分结果。最后,将该备选方向上的差分结果,作为该计算块在该备选方向上的梯度强度。Next, a difference calculation is performed based on the reference pixel pair. Among them, difference is also known as difference function or difference operation, and the result of difference can reflect a change between discrete quantities. Specifically, during the calculation, the absolute value of the pixel value difference between the two pixel points in each reference pixel point pair can be calculated, and then the sum of all absolute values can be calculated to obtain the difference result. Finally, the difference result in the alternative direction is used as the gradient strength of the calculation block in the alternative direction.
示例的,假设计算块为图5中划分的4*4的计算块,n为4。从计算块的任一顶点为原点,分别沿着水平的X轴方向以及竖直的Y轴方向依次按照0,1,2,3为像素编号,那么,一个计算块在水平方向上的梯度强度GH可以表示为:For example, it is assumed that the calculation block is a 4*4 calculation block divided in FIG. 5 , and n is 4. From any vertex of the calculation block as the origin, the pixels are numbered according to 0, 1, 2, and 3 along the horizontal X-axis direction and the vertical Y-axis direction respectively, then, the gradient strength of a calculation block in the horizontal direction GH can be expressed as:
G H=|p(0,3)-p(0,1)|+|p(1,2)-p(1,0)|+|p(2,3)-p(2,1)|+|p(3,2)-p(3,0)| G H =|p(0,3)-p(0,1)|+|p(1,2)-p(1,0)|+|p(2,3)-p(2,1)| +|p(3,2)-p(3,0)|
在垂直方向上的梯度强度G v可以表示为: The gradient strength G v in the vertical direction can be expressed as:
G V=|p(3,0)-p(1,0)|+|p(2,1)-p(0,1)|+|p(3,2)-p(1,2)|+|p(2,3)-p(0,3)| G V =|p(3,0)-p(1,0)|+|p(2,1)-p(0,1)|+|p(3,2)-p(1,2)| +|p(2,3)-p(0,3)|
在右下方向上的梯度强度G rd可以表示为: The gradient strength G rd in the lower right direction can be expressed as:
G rd=|p(0,0)-p(2,2)|+|p(1,1)-p(3,3)|+|p(2,0)-p(3,1)|+|p(0,2)-p(1,3)| G rd =|p(0,0)-p(2,2)|+|p(1,1)-p(3,3)|+|p(2,0)-p(3,1)| +|p(0,2)-p(1,3)|
在左下方向上的梯度强度G ld可以表示为: The gradient strength G ld in the lower left direction can be expressed as:
G ld=|p(0,3)-p(2,1)|+|p(1,2)-p(3,0)|+|p(0,1)-p(1,0)|+|p(2,3)-p(3,2)| G ld =|p(0,3)-p(2,1)|+|p(1,2)-p(3,0)|+|p(0,1)-p(1,0)| +|p(2,3)-p(3,2)|
进一步地,图6是本公开实施例提供的一种计算块的梯度方向示意图,可以看出,计算块的梯度方向包括(3a)示出的水平方向、(3b)示出的垂直方向、(3c)示出的右下方向及(3d)示出的左下方向。Further, FIG. 6 is a schematic diagram of a gradient direction of a calculation block provided by an embodiment of the present disclosure. It can be seen that the gradient direction of the calculation block includes the horizontal direction shown in (3a), the vertical direction shown in (3b), The lower right direction shown in 3c) and the lower left direction shown in (3d).
步骤3043、根据所述备选方向上的计算块的梯度强度,计算所述当前PU在所述备选方向上对应的梯度强度。Step 3043: Calculate the gradient strength corresponding to the current PU in the candidate direction according to the gradient strength of the calculation block in the candidate direction.
具体的,可以计算所有计算块在该备选方向的计算块的梯度强度之和,将该梯度强度之和,确定为当前PU在该备选方向上对应的梯度强度。进一步地,图7是本公开实施例提供的一种PU的梯度方向示意图,可以看出,PU的梯度方向包括(4a)示出的水平方向、(4b)示出的垂直方向、(4c)示出的右下方向及(4d)示出的左下方向。Specifically, the sum of the gradient strengths of the calculation blocks of all calculation blocks in the candidate direction may be calculated, and the sum of the gradient strengths may be determined as the gradient strength corresponding to the current PU in the candidate direction. Further, FIG. 7 is a schematic diagram of a gradient direction of a PU provided by an embodiment of the present disclosure, and it can be seen that the gradient directions of the PU include the horizontal direction shown in (4a), the vertical direction shown in (4b), and (4c) The lower right direction shown and the lower left direction shown by (4d).
本公开实施例中,通过将当前PU划分为多个计算块,以计算块为梯度计算对象,仅需计算这些计算块在备选方向上的梯度强度,基于这些计算块的梯度强度即可计算出当前PU在该备选方向上对应的梯度强度。这样,一定程 度上可以简化梯度计算过程,降低梯度计算带来的计算量,继而提高计算效率。示例的,以图5中的当前PU为例,如果采用常规的计算方式,不进行划分的话,就需要分别针对64个像素点计算这64个像素点在备选方向上的梯度强度,得到64个梯度强度。然后对这64个梯度强度进行计算,才能得到当前PU在备选方向上的梯度强度,例如,计算该备选方向上所有像素点的梯度强度之和,即计算SAG=Σ(G(x,y))。而采用本公开实施例提供的计算方式,仅需计算4个计算块在备选方向上的梯度强度,得到4个梯度强度。然后对这4个梯度强度进行计算,即可得到当前PU在备选方向上的梯度强度。由此可见,相较于现有技术中,在备选方向上针对当前PU中的像素点,逐个点做差分的方式,本公开实施例提供的方式可以简化梯度计算过程,降低梯度计算带来的计算量,进而提高计算效率。In the embodiment of the present disclosure, by dividing the current PU into multiple calculation blocks, and taking the calculation blocks as the gradient calculation objects, it is only necessary to calculate the gradient strengths of these calculation blocks in the alternative directions, and the calculation can be done based on the gradient strengths of these calculation blocks. The gradient strength corresponding to the current PU in the alternative direction is obtained. In this way, the gradient calculation process can be simplified to a certain extent, the calculation amount caused by the gradient calculation can be reduced, and the calculation efficiency can be improved. As an example, taking the current PU in FIG. 5 as an example, if a conventional calculation method is used and no division is performed, it is necessary to calculate the gradient strengths of the 64 pixels in the alternative directions for the 64 pixels respectively, and obtain 64 gradient strength. Then the 64 gradient strengths are calculated to obtain the gradient strength of the current PU in the alternative direction. For example, the sum of the gradient strengths of all pixels in the alternative direction is calculated, that is, the calculation SAG=Σ(G(x, y)). However, by using the calculation method provided by the embodiment of the present disclosure, it is only necessary to calculate the gradient intensities of the four calculation blocks in the alternative directions, and obtain four gradient intensities. Then, these four gradient strengths are calculated to obtain the gradient strength of the current PU in the alternative direction. It can be seen that, compared with the prior art, in which the pixel points in the current PU are differentiated point by point in the alternative directions, the method provided by the embodiment of the present disclosure can simplify the gradient calculation process and reduce the burden caused by the gradient calculation. the amount of computation, thereby improving the computational efficiency.
同时,本公开实施例中,在计算计算块的梯度强度时,通过间隔抽取像素点参与计算,可以减少参与计算的像素点的数量,进而进一步降低计算量。同时,相较于现有技术中,逐个点进行差分的方式,本公开实施例中,通过间隔抽取像素点参与计算的方式,也可以避免相近点的差值过小,导致最终计算结果不能够准确反映纹理的问题。当然,也可以采用其他方式计算梯度强度,例如,通过二维离散函数求导数的方式计算,等等,本公开实施例对此不做限定。Meanwhile, in the embodiment of the present disclosure, when calculating the gradient strength of the calculation block, the pixel points are extracted at intervals to participate in the calculation, which can reduce the number of pixel points participating in the calculation, thereby further reducing the amount of calculation. At the same time, compared with the method of performing the difference point by point in the prior art, in the embodiment of the present disclosure, the method of extracting pixel points at intervals to participate in the calculation can also avoid that the difference between the adjacent points is too small, resulting in the final calculation result being unable to be calculated. Accurately reflect the texture of the problem. Of course, the gradient intensity may also be calculated in other ways, for example, by calculating the derivative by using a two-dimensional discrete function, and so on, which is not limited in this embodiment of the present disclosure.
需要说明的是,本公开实施例中,在计算当前PU的梯度强度,即,进行纹理检测之前,还可以先对视频图像进行低通滤波,以降低视频图像中包含的干扰信息,进而提高纹理检测的效果。It should be noted that, in this embodiment of the present disclosure, before calculating the gradient strength of the current PU, that is, before performing texture detection, low-pass filtering may also be performed on the video image to reduce interference information contained in the video image, thereby improving texture detection effect.
步骤3044、将对应的梯度强度最小的备选方向,确定为所述第二方向。Step 3044: Determine the corresponding candidate direction with the smallest gradient strength as the second direction.
本步骤中,可以将每个备选方向对应的梯度强度的大小进行比对,然后选择出数值最小的梯度强度,接着,将该最小的梯度强度对应的备选方向,确定为第二方向。示例的,假设最小的梯度强度对应的备选方向为水平方向,那么可以将水平方向确定为第二方向。本公开实施例中,通过选择梯度最小的备选方向作为第二方向,即,选择最小梯度方向,可以使得选择的第二方向是当前PU纹理性最强的方向,进而可以确保该第二方向的可信赖程度。In this step, the magnitudes of the gradient strengths corresponding to each candidate direction may be compared, and then the gradient strength with the smallest value is selected, and then the candidate direction corresponding to the minimum gradient strength is determined as the second direction. Exemplarily, assuming that the candidate direction corresponding to the smallest gradient strength is the horizontal direction, the horizontal direction may be determined as the second direction. In the embodiment of the present disclosure, by selecting the candidate direction with the smallest gradient as the second direction, that is, selecting the minimum gradient direction, the selected second direction can be the direction with the strongest texture of the current PU, and then the second direction can be ensured reliability.
步骤305、根据所述第一方向与所述第二方向之间的相对关系,从所述备选方向中选择所述候选方向。Step 305: Select the candidate direction from the candidate directions according to the relative relationship between the first direction and the second direction.
实际应用场景中,视频图像的纹理方向,即,纹理性较强的方向,往往与编码效果较好的模式的方向,例如,最优模式的方向存在相似性,编码效果较好的模式的方向往往也会具有较强的纹理性。且利用不同模式对图像编码时,编码效果会受到图像纹理的影响,而第二方向可以表征当前PU的图像纹理的规律性较强的方向,因此,本公开实施例中,可以结合第一方向和第二方向,即,结合最小代价方向和最小梯度方向,选择候选方向。In practical application scenarios, the texture direction of the video image, that is, the direction with strong texture, is often similar to the direction of the mode with better coding effect, for example, the direction of the optimal mode is similar, and the direction of the mode with better coding effect is similar. Often also has a strong texture. And when using different modes to encode an image, the encoding effect will be affected by the image texture, and the second direction can represent the direction with strong regularity of the image texture of the current PU. Therefore, in this embodiment of the present disclosure, the first direction can be combined. and the second direction, that is, the candidate direction is selected by combining the minimum cost direction and the minimum gradient direction.
具体的,若所述第一方向与所述第二方向平行,则将所述第一方向表示的备选方向,确定为所述候选方向。如果第一方向与第二方向平行,则说明最小代价方向和最小梯度方向一致,当前PU表示的图像具有较强的纹理性,纹理检测的结果可信赖,参考性较高,即,确定的第二方向可信赖。而由于第一方向与第二方向具有相似性,因此,在第二方向可信赖的情况下,可以认为第一方向是可信赖的,进而可以仅将第一方向表示的备选方向确定为候选方向。即,仅在第二方向上确定为候选方向。本公开实施例中,通过在最小代价方向和最小梯度方向一致,可信赖程度较高的情况下,选择两者表示的备选方向作为候选方向的方式,可以在确保后续能够基于候选方向较为准确的筛选候选模式的同时,尽可能减少候选方向的数量,进而降低后续处理的处理量。Specifically, if the first direction is parallel to the second direction, the candidate direction indicated by the first direction is determined as the candidate direction. If the first direction is parallel to the second direction, it means that the minimum cost direction and the minimum gradient direction are consistent, the image represented by the current PU has strong texture, the texture detection result is reliable, and the reference is high, that is, the determined first Both directions are reliable. However, since the first direction is similar to the second direction, if the second direction is reliable, the first direction can be considered to be reliable, and then only the candidate direction represented by the first direction can be determined as a candidate direction. That is, only the second direction is determined as a candidate direction. In the embodiment of the present disclosure, when the minimum cost direction and the minimum gradient direction are consistent and have a high degree of reliability, the candidate direction represented by the two is selected as the candidate direction, which can ensure that the candidate direction can be more accurate in the future based on the candidate direction. While screening candidate modes, reduce the number of candidate directions as much as possible, thereby reducing the amount of subsequent processing.
进一步地,如果两者不平行,可以进一步判断两者是否垂直,若所述第一方向与所述第二方向垂直,则选择至少两个所述备选方向,作为所述候选方向。如果第一方向与第二方向垂直行,则说明最小代价方向和最小梯度方向存在较大差异,当前PU表示的图像的纹理性较弱,纹理检测的结果可信赖程度较低,即,可以认为第一方向可信赖程度较低,参考性较低高。且纹理性较弱往往是由于图像的纹理比较复杂杂乱,或者纹理细节很少导致的,这种情况下,如果仅在单一方向上确定候选模式,可能会导致最终基于候选模式筛选出来的模式不能较好的对当前PU进行编码。因此,可以选择多个备选方向作为候选方向,这样,可以确保后续基于该候选方向筛选的候选模式确定出的最优模式能够较好的对当前PU进行编码,进而确保后续的编码效果。同时,选择的至少两个备选方向中可以包含第一方向表示的备选方向。由于第一方向是对应的角度代表模式下的编码效果参数较好的备选方向,因此,将第一方向选中,一定程度上可以进一步确保后续基于该候选方向筛选的候选模式确定出的最优模式的编码效果。进一步地,可以选择所有备选方向,作为候选方向。以备选方向为4为例,可以将这4个备选方向确定为候选方向,在这4个方向上候选。这样,通过将所有备选防线确定为候选方向,可以较大程度的提高覆盖方向,进而确保后续基于该候选方向筛选的候选模式确定出的最优模式的编码效果。Further, if the two are not parallel, it can be further determined whether the two are perpendicular, and if the first direction is perpendicular to the second direction, at least two of the candidate directions are selected as the candidate directions. If the first direction is perpendicular to the second direction, it means that there is a big difference between the minimum cost direction and the minimum gradient direction, the texture of the image represented by the current PU is weak, and the result of texture detection is less reliable, that is, it can be considered that The reliability of the first direction is low, and the reference is low and high. And the weak texture is often caused by the complex texture of the image, or the lack of texture details. In this case, if the candidate mode is only determined in a single direction, it may lead to the final selection based on the candidate mode. Better to encode the current PU. Therefore, multiple candidate directions can be selected as candidate directions, so that it can be ensured that the optimal mode determined based on the candidate modes screened in the candidate direction can better encode the current PU, thereby ensuring the subsequent encoding effect. Meanwhile, the selected at least two candidate directions may include the candidate direction represented by the first direction. Since the first direction is an alternative direction with better coding effect parameters in the corresponding angle representative mode, selecting the first direction can further ensure the optimal selection determined by the candidate mode selected based on the candidate direction to a certain extent. The encoding effect of the mode. Further, all candidate directions may be selected as candidate directions. Taking 4 candidate directions as an example, the 4 candidate directions can be determined as candidate directions, and candidates can be made in these 4 directions. In this way, by determining all the candidate defense lines as candidate directions, the coverage direction can be greatly improved, thereby ensuring the coding effect of the optimal mode determined based on the candidate modes screened in the candidate direction subsequently.
进一步地,若所述第一方向与所述第二方向之间形成预设角度的夹角,则将所述第一方向表示的备选方向及所述第二方向表示的备选方向,确定为候选方向;其中,所述预设角度为除0度及90度之外的角度。Further, if an included angle of a preset angle is formed between the first direction and the second direction, the candidate direction represented by the first direction and the candidate direction represented by the second direction are determined. is a candidate direction; wherein, the preset angle is an angle other than 0 degrees and 90 degrees.
如果第一方向与第二方向之间形成预设角度的夹角,即,两者即不平行,也不垂直。则说明最小代价方向和最小梯度方向存在一些差异,但纹理检测的结果具有一定的可信赖程度,具有一定的参考性。因此,可以选择第一方向表示的备选方向及第二方向表示的备选方向作为候选方向。这样,通过同 时选择第一方向及第二方向表示的备选方向作为候选方向,一定程度上可以弥补参考性较低的问题,进而提高候选方向的准确性。If a predetermined angle is formed between the first direction and the second direction, that is, the two directions are neither parallel nor perpendicular. It means that there are some differences between the minimum cost direction and the minimum gradient direction, but the result of texture detection has a certain degree of reliability and has a certain reference. Therefore, the candidate directions represented by the first direction and the candidate directions represented by the second direction may be selected as candidate directions. In this way, by simultaneously selecting the candidate directions represented by the first direction and the second direction as the candidate directions, the problem of low reference can be compensated to a certain extent, thereby improving the accuracy of the candidate directions.
本公开实施例中,通过结合第一方向和第二方向,即结合最小代价方向和最小梯度方向进行双重验证判断,通过最小梯度方向辅助判断,并根据判断结果,有针对性的选择候选方向,进而可以提高初步筛选出的候选方向的准确度。由于初步筛选的候选方向,对方案最终选中的模式影响较大,因此,发明实施例中,通过提高该准确度,可以确保方案整体的精度。In the embodiment of the present disclosure, by combining the first direction and the second direction, that is, combining the minimum cost direction and the minimum gradient direction, a double verification judgment is performed, the minimum gradient direction is used to assist the judgment, and according to the judgment result, the candidate direction is selected in a targeted manner, Further, the accuracy of the candidate directions that are initially screened can be improved. Since the candidate directions of the preliminary screening have a great influence on the mode finally selected by the scheme, in the embodiment of the invention, by improving the accuracy, the overall accuracy of the scheme can be ensured.
步骤306、对于任一所述候选方向,以所述候选方向对应的角度模式为中心,按照第一预设步长,从所述对应的角度模式两侧的模式中,等间距选择p个模式,作为第一备选模式。Step 306: For any of the candidate directions, centering on the angle pattern corresponding to the candidate direction, according to the first preset step size, select p patterns at equal intervals from the patterns on both sides of the corresponding angle pattern. , as the first alternative mode.
本步骤中,第一预设步长可以是根据实际情况预先设定的,第一预设步长可以大于1,可以通过设置第一预设步长大于1,可以确保在候选方向较多的情况下,最终选出的候选模式的数量不会太多,进而可以避免计算量较大。示例的,该第一预设步长可以为2。进一步地,p的具体值也可以是根据实际情况预先设定的,例如,p可以为4。具体的选择时,可以以候选方向对应的角度模式为中心,将该对应的角度模式及其两侧的模式作为选择对象。按照第一预设步长开始等间距选择。In this step, the first preset step size may be preset according to the actual situation, and the first preset step size may be greater than 1. By setting the first preset step size greater than 1, it can be ensured that there are more candidate directions. In this case, the number of candidate modes finally selected will not be too many, which can avoid a large amount of calculation. For example, the first preset step size may be 2. Further, the specific value of p may also be preset according to the actual situation, for example, p may be 4. During specific selection, the angle pattern corresponding to the candidate direction may be taken as the center, and the corresponding angle pattern and the patterns on both sides thereof may be selected as objects. Start the selection at equal intervals with the first preset step.
假设在第一预设步长为2,p为4。在候选方向为水平方向,候选方向对应的角度模式为角度模式10,从对应的角度模式的两侧的模式中,等间距选择p个模式时,可以以先角度模式7或者角度模式13为起点,先抽取起点处的角度模式,然后从抽取出来的角度模式处出发,抽取经过第以预设步长之后所到达处的角度模式,以此类推,可以得到第一备选模式:角度模式7、角度模式9、角度模式11、角度模式13。相应地,在候选方向为垂直方向,候选方向对应的角度模式为角度模式26时,从对应的角度模式的两侧,等间距选择p个模式,可以得到第一备选模式:角度模式23、角度模式25、角度模式27、角度模式29。在候选方向为右下方向,候选方向对应的角度模式为角度模式18时,从对应的角度模式的两侧,等间距选择p个模式,可以得到第一备选模式:角度模式15、角度模式17、角度模式19、角度模式21。在候选方向为左下方向,候选方向对应的角度模式为角度模式2时,从对应的角度模式的两侧,等间距选择p个模式,可以得到第一备选模式:角度模式3、角度模式5、角度模式31、角度模式33。本公开实施例中,通过第一预设步长等间距的进行选择抽取,这样,可以确保最后得到的第一备选模式均匀分布,进而方便后续在第一备选模式的基础上进一步选取。Assume that the first preset step size is 2 and p is 4. When the candidate direction is the horizontal direction, and the angle pattern corresponding to the candidate direction is the angle pattern 10, when selecting p patterns at equal intervals from the patterns on both sides of the corresponding angle pattern, the first angle pattern 7 or the angle pattern 13 can be used as the starting point. , first extract the angle pattern at the starting point, then start from the extracted angle pattern, extract the angle pattern reached after the first preset step, and so on, the first alternative pattern can be obtained: angle pattern 7 , Angle Mode 9, Angle Mode 11, Angle Mode 13. Correspondingly, when the candidate direction is the vertical direction and the angle mode corresponding to the candidate direction is the angle mode 26, p modes are selected at equal intervals from both sides of the corresponding angle mode, and the first candidate mode can be obtained: the angle mode 23, Angle Mode 25, Angle Mode 27, Angle Mode 29. When the candidate direction is the lower right direction and the angle mode corresponding to the candidate direction is the angle mode 18, select p modes at equal intervals from both sides of the corresponding angle mode, and the first candidate mode can be obtained: angle mode 15, angle mode 17. Angle Mode 19, Angle Mode 21. When the candidate direction is the lower left direction and the angle mode corresponding to the candidate direction is angle mode 2, select p modes at equal intervals from both sides of the corresponding angle mode, and the first candidate modes can be obtained: angle mode 3, angle mode 5 , Angle Mode 31, Angle Mode 33. In the embodiment of the present disclosure, selection and extraction are performed at equal intervals by the first preset step size, so that the final obtained first candidate mode can be uniformly distributed, thereby facilitating further selection on the basis of the first candidate mode in the future.
步骤307、根据所述第一备选模式确定第一候选模式,以及将所述预设编码标准提供的非角度模式确定为第二候选模式。Step 307: Determine a first candidate mode according to the first candidate mode, and determine a non-angular mode provided by the preset coding standard as a second candidate mode.
具体的根据第一备选模式确定第一候选模式的操作,可以通过下述操作 实现:计算所述当前PU在各个所述第一备选模式下的率失真代价;将前q个最大的率失真代价对应的第一备选模式,作为第二备选模式;将所述第二备选模式两侧相邻的角度模式,确定为所述第一候选模式。Specifically, the operation of determining the first candidate mode according to the first candidate mode may be implemented by the following operations: calculating the rate-distortion cost of the current PU in each of the first candidate modes; The first candidate mode corresponding to the distortion cost is used as the second candidate mode; the angle modes adjacent to both sides of the second candidate mode are determined as the first candidate mode.
其中,计算当前PU在各个第一备选模式下的率失真代价的具体实现方式,可以参照前述步骤中计算率失真代价的相关描述,本公开实施例在此不做赘述。进一步地,q的具体值根据实际情况设置,示例的,q可以为2。可以将率失真代价由大至小进行排序,然后选择前2个率失真代价对应的第一备选模式作为第二备选模式。假设第二备选角度模为角度模式7及角度模式13,那么选择的第一候选模式可以为角度模式6、角度模式8,角度模式12、角度模式14。需要说明的是,在确定出第一候选模式之后,可以对第一候选模式进行去重处理,以精简第一候选模式的数量,进而减小后续的计算量。或者也可以直接将第一备选模式确定为第一候选模式,即省略进一步筛选的操作,进而减小计算量。For the specific implementation manner of calculating the rate-distortion cost of the current PU in each of the first alternative modes, reference may be made to the relevant description of calculating the rate-distortion cost in the preceding steps, which is not repeated in this embodiment of the present disclosure. Further, the specific value of q is set according to the actual situation. For example, q may be 2. The rate-distortion costs may be sorted in descending order, and then the first candidate mode corresponding to the first two rate-distortion costs may be selected as the second candidate mode. Assuming that the second candidate angle modes are angle mode 7 and angle mode 13 , the selected first candidate modes may be angle mode 6 , angle mode 8 , angle mode 12 , and angle mode 14 . It should be noted that, after the first candidate mode is determined, deduplication processing may be performed on the first candidate mode, so as to reduce the number of the first candidate mode, thereby reducing the subsequent calculation amount. Alternatively, the first candidate mode can also be directly determined as the first candidate mode, that is, the operation of further screening is omitted, thereby reducing the amount of calculation.
进一步地,由于非角度模式的方向性很弱,在针对候选方向周围模式的选择过程中,很难被覆盖到,因此,本步骤中可以直接将非角度模式确定为第二候选模式,即,确保非角度模式也可以加入筛选,进而可以在提高筛选效率的同时,确保能够全面覆盖,全面筛选,进而提高筛选结果的准确性。示例的,以预设编码标准为HEVC标准为例,们可以将planar模式和dc模式确定为第二候选模式。Further, since the directionality of the non-angle mode is very weak, it is difficult to be covered in the selection process of the mode around the candidate direction. Therefore, in this step, the non-angle mode can be directly determined as the second candidate mode, that is, It is ensured that non-angle mode can also be added to screening, which can improve the screening efficiency while ensuring comprehensive coverage and comprehensive screening, thereby improving the accuracy of screening results. By way of example, taking the preset coding standard as the HEVC standard as an example, we may determine the planar mode and the dc mode as the second candidate mode.
步骤308、将所述第一候选模式及所述第二候选模式,确定为所述候选模式,以及,将所述角度代表模式及所述第一备选模式,加入所述候选模式。Step 308: Determine the first candidate mode and the second candidate mode as the candidate mode, and add the angle representative mode and the first candidate mode to the candidate mode.
本公开实施例中,通过多级筛选得到第一候选模式及第二候选模式,最后将第一候选模式及第二候选模式确定为候选模式,一定程度上可以确保最终筛选出的候选模式的准确性。进一步地,通过将所述角度代表模式及所述第一备选模式,也加入候选模式中,即,以角度代表模式作为一级候选模式,将第一备选模式及非角度模式作为二级候选模式,将第一候选模式作为三级候选模式,通过采用多级候选模式,可以避免层层筛选,导致最终筛选结果陷入局部最优,进而导致筛选结果不理想的问题。In the embodiment of the present disclosure, the first candidate mode and the second candidate mode are obtained through multi-level screening, and finally the first candidate mode and the second candidate mode are determined as candidate modes, which can ensure the accuracy of the final selected candidate mode to a certain extent. sex. Further, by adding the angle representative mode and the first candidate mode to the candidate modes, that is, the angle representative mode is used as the first-level candidate mode, and the first candidate mode and the non-angle mode are used as the second-level candidate mode. In the candidate mode, the first candidate mode is regarded as the third-level candidate mode. By adopting the multi-level candidate mode, layer-by-layer screening can be avoided, resulting in the final screening result falling into a local optimum, which in turn leads to the problem of unsatisfactory screening results.
进一步地,需要说明的是,本公开实施例在确定出候选模式之后,还可以执行下述操作:确定所述候选模式对应的率失真代价;若所述候选模式对应的率失真代价大于预设率失真代价阈值,则剔除所述候选模式。其中,如果前述步骤中针对该候选模式计算过其对应的率失真代价,则可以直接从前述步骤的计算结果中获取其对应的率失真代价,这样,可以减少计算量。若没有,则可以参考前述步骤中有关计算方式的描述进行计算。进一步地,预设率失真代价阈值可以是根据实际应用场景中,不会成为最优模式的模式所对应的率失真代价设置。或者,也可以是根据实验过程中计算出的最小率失 真代价设置,例如,将该阈值设置为最小率失真代价的1.2倍。其中,该最小率失真代价可以是基于SATD计算的率失真代价的。Further, it should be noted that, after the candidate mode is determined in this embodiment of the present disclosure, the following operations may be performed: determine the rate-distortion cost corresponding to the candidate mode; if the rate-distortion cost corresponding to the candidate mode is greater than a preset value If the rate-distortion cost threshold is set, the candidate mode is eliminated. Wherein, if the corresponding rate-distortion cost has been calculated for the candidate mode in the foregoing steps, the corresponding rate-distortion cost can be obtained directly from the calculation result of the foregoing steps, thus reducing the amount of computation. If not, the calculation can be performed with reference to the description of the calculation method in the preceding steps. Further, the preset rate-distortion cost threshold may be set according to the rate-distortion cost corresponding to a mode that does not become the optimal mode in an actual application scenario. Alternatively, it can also be set according to the minimum rate-distortion cost calculated during the experiment, for example, the threshold is set to 1.2 times the minimum rate-distortion cost. Wherein, the minimum rate-distortion cost may be based on the rate-distortion cost calculated by SATD.
相应地,若候选模式对应的率失真代价大于该预设率失真代价阈值,则可以认为该候选模式大概率不会成为最优模式,因此,可以将其剔除。这样,通过对候选模式选择性的进行剔除,可以精简候选模式的数量,进而降低后续从候选模式中进行筛选时的计算量。Correspondingly, if the rate-distortion cost corresponding to the candidate mode is greater than the preset rate-distortion cost threshold, it can be considered that the candidate mode has a high probability that it will not become the optimal mode, so it can be eliminated. In this way, by selectively eliminating the candidate modes, the number of candidate modes can be reduced, thereby reducing the amount of calculation in subsequent screening from the candidate modes.
实际应用场景中,在上述操作之后,即完成粗略模式选择(RoughMode Decision,RMD)阶段之后,可以继续执行添加最有可能模式(Most Possible Modes,MPM)阶段,精确模式选择(Fine Mode Decision,FMD)阶段。具体的,由于相邻PU之间往往具有很强的相关性,已编码的相邻PU的最优模式对当前块也是有参考价值的。因此,本公开实施例中,可以基于前述选择的候选模式生成候选列表,根据当前PU周围的已编码PU的最优模式确定MPM模式,然后将MPM模式也加入为候选列表,参与后续的选择。其中,MPM模式可以是依据已编码的相邻PU的空间相关性由已编码的相邻PU,例如,上方与左侧的已编码的相邻PU的最优模式得到确定的。具体MPM模式的具体个数可以根据实际情况来设置,例如,在仿真平台HM16.0中,MPM的个数可以为3,具体再确定时,可以先获取上方和左侧的已编码相邻PU的最优模式,然后根据这两个最优模式自身的特性以及相互之间的关系,依次对三个MPM进行赋值,进而得到3个MPM模式。In the actual application scenario, after the above operation, that is, after the rough mode selection (Rough Mode Decision, RMD) stage is completed, the stage of adding the most probable modes (Most Possible Modes, MPM) can be continued, and the fine mode selection (Fine Mode Decision, FMD) stage can be continued. )stage. Specifically, since there is often a strong correlation between adjacent PUs, the optimal mode of the coded adjacent PUs is also valuable for the current block. Therefore, in this embodiment of the present disclosure, a candidate list may be generated based on the previously selected candidate mode, the MPM mode may be determined according to the optimal mode of the coded PU around the current PU, and then the MPM mode may also be added to the candidate list for subsequent selection. The MPM mode may be determined from the optimal modes of the coded adjacent PUs, eg, the upper and left coded adjacent PUs, according to the spatial correlation of the coded adjacent PUs. The specific number of specific MPM modes can be set according to the actual situation. For example, in the simulation platform HM16.0, the number of MPMs can be 3. When determining the specific number, the coded adjacent PUs on the upper and left sides can be obtained first. Then, according to the characteristics of the two optimal modes and the relationship between them, the three MPMs are assigned values in turn, and then three MPM modes are obtained.
接着,可以对候选列表中的所有模式依次计算基于RDO的率失真代价,选择率失真代价最小的预测模式作为最优模式。其中,RDO代价的求解包含了一次完整的编码过程,因此可以精确地选出最优模式,但该过程需要对预测像素的残差进行DCT变换、量化得到残差系数、熵编码得到该预测模式下编码的比特数,另一方面需要对残差系数进行反量化、反变换得到重建图像以获得失真度,最后依据比特数和失真度才能计算该预测模式的率失真代价,复杂度极高。因此,实际应用中,也可以采用其他方式计算率失真代价,并进行选择,进而最优模式选择的复杂度。需要说明的是,进行FMD阶段之前,还可以对候选列表中包含的模式进行去重处理,以精简FMD阶段需要计算的对象数量,进而减小计算量。Next, the rate-distortion cost based on RDO can be calculated for all modes in the candidate list in turn, and the prediction mode with the smallest rate-distortion cost is selected as the optimal mode. Among them, the solution of the RDO cost includes a complete encoding process, so the optimal mode can be accurately selected, but this process requires DCT transformation of the residual of the predicted pixels, quantization to obtain residual coefficients, and entropy encoding to obtain the prediction mode. On the other hand, it is necessary to inverse quantize and inverse transform the residual coefficient to obtain the reconstructed image to obtain the distortion degree. Finally, the rate-distortion cost of the prediction mode can be calculated according to the number of bits and the distortion degree, and the complexity is extremely high. Therefore, in practical applications, other methods can also be used to calculate the rate-distortion cost and select it, thereby optimizing the complexity of mode selection. It should be noted that, before the FMD stage, the pattern included in the candidate list may also be deduplicated, so as to reduce the number of objects to be calculated in the FMD stage, thereby reducing the amount of calculation.
本公开实施例提供的模式选择方法,通过从预设编码标准提供的角度模式中,选择m个角度代表模式,m小于预设编码标准提供的角度模式的数量,将角度代表模式表示的方向作为备选方向,并根据当前预测单元PU在各个角度代表模式下的编码效果参数,从备选方向中选择当前PU对应的第一方向,根据当前PU在各个备选方向上的梯度强度,从备选方向中选择当前PU对应的第二方向。接着结合这两个方向,从备选方向中选择候选方向。最后,根据候选方向,从角度模式中确定第一候选模式,将非角度模式确定为第二候 选模式,最后将第一候选模式及第二候选模式确定为候选模式。这样,通过先选择角度代表模式确定出最优模式可能在的候选方向,并仅在该候选方向周围的模式上选择候选模式,一定程度上可以减小筛选候选模式时需要判断的模式数量,进而降低计算量以及耗时,提高效率。同时,由于非角度模式的方向性很弱,在针对候选方向周围模式的选择过程中,很难被覆盖到,因此,通过直接将非角度模式确定为第二候选模式,即,让非角度模式也可以加入筛选,可以在提高筛选效率的同时,确保能够全面覆盖,进而提高筛选结果的准确性。进一步地,通过结合第一方向和第二方向,即结合最小代价方向和最小梯度方向进行双重验证判断,通过最小梯度方向辅助判断,并根据判断结果,有针对性的选择候选方向,进而可以提高初步筛选出的候选方向的准确度。The mode selection method provided by the embodiment of the present disclosure selects m angle representative modes from the angle modes provided by the preset coding standard, where m is smaller than the number of angle modes provided by the preset coding standard, and takes the direction represented by the angle representative mode as Alternative directions, and according to the coding effect parameters of the current prediction unit PU in each angle representative mode, select the first direction corresponding to the current PU from the alternative directions, and according to the gradient strength of the current PU in each alternative direction, from the alternative directions In the selection direction, select the second direction corresponding to the current PU. Then, combining these two directions, a candidate direction is selected from the candidate directions. Finally, according to the candidate directions, the first candidate mode is determined from the angle modes, the non-angle mode is determined as the second candidate mode, and finally the first candidate mode and the second candidate mode are determined as the candidate modes. In this way, by first selecting the angle representative mode to determine the possible candidate direction of the optimal mode, and selecting the candidate mode only on the modes around the candidate direction, the number of modes that need to be judged when screening the candidate modes can be reduced to a certain extent, and then Reduce the amount of calculation and time-consuming, and improve efficiency. At the same time, due to the weak directivity of the non-angle mode, it is difficult to be covered in the selection process for the surrounding modes of the candidate direction. Therefore, by directly determining the non-angle mode as the second candidate mode, that is, let the non-angle mode Screening can also be added to ensure comprehensive coverage while improving screening efficiency, thereby improving the accuracy of screening results. Further, by combining the first direction and the second direction, that is, combining the minimum cost direction and the minimum gradient direction, a double verification judgment is performed, the minimum gradient direction is used to assist the judgment, and according to the judgment result, the candidate direction can be selected in a targeted manner, which can improve the The accuracy of the initially screened candidate directions.
图8是本公开实施例提供的一种模式选择装置的框图,如图8所示,该装置40可以包括:FIG. 8 is a block diagram of a mode selection apparatus provided by an embodiment of the present disclosure. As shown in FIG. 8 , the apparatus 40 may include:
第一选择模式401,用于从预设编码标准提供的角度模式中,选择m个角度代表模式;所述m小于所述预设编码标准提供的角度模式的数量;The first selection mode 401 is used to select m angle representative modes from the angle modes provided by the preset coding standard; the m is less than the number of angle modes provided by the preset coding standard;
第一确定模式402,用于将所述角度代表模式表示的方向作为备选方向,并根据当前预测单元PU在各个所述角度代表模式下的编码效果参数,从所述备选方向中确定当前PU对应的第一方向;所述第一方向对应的角度代表模式下的编码效果参数满足第一预设条件;The first determination mode 402 is configured to use the direction represented by the angle representative mode as an alternative direction, and determine the current direction from the alternative directions according to the coding effect parameters of the current prediction unit PU in each of the angle representative modes. The first direction corresponding to the PU; the angle corresponding to the first direction represents the encoding effect parameter in the mode meeting the first preset condition;
第二选择模式403,用于根据所述第一方向从所述备选方向中选择候选方向;所述候选方向中至少包括所述第一方向;A second selection mode 403, configured to select a candidate direction from the candidate directions according to the first direction; the candidate directions include at least the first direction;
第三选择模式404,用于基于所述候选方向周围的模式,从所述预设编码标准提供的模式中选择候选模式。A third selection mode 404 is configured to select a candidate mode from modes provided by the preset coding standard based on modes around the candidate direction.
可选的,所述第二选择模式403,具体用于:Optionally, the second selection mode 403 is specifically used for:
根据所述当前PU在各个所述备选方向上的梯度强度,从所述备选方向中选择当前PU对应的第二方向;所述第二方向上的梯度强度满足第二预设条件。According to the gradient strength of the current PU in each of the candidate directions, a second direction corresponding to the current PU is selected from the candidate directions; the gradient strength in the second direction satisfies a second preset condition.
根据所述第一方向与所述第二方向之间的相对关系,从所述备选方向中选择所述候选方向。The candidate direction is selected from the candidate directions according to the relative relationship between the first direction and the second direction.
可选的,所述第二选择模式403,还具体用于:Optionally, the second selection mode 403 is also specifically used for:
将所述当前PU划分为至少两个计算块;其中,一个所述计算块包含至少两个像素点。The current PU is divided into at least two calculation blocks; wherein one of the calculation blocks includes at least two pixel points.
对于任一所述备选方向,根据各个所述计算块中包含的像素点的像素值,计算所述计算块在所述备选方向上的梯度强度。For any of the alternative directions, the gradient strength of the calculation block in the alternative direction is calculated according to the pixel values of the pixel points included in each of the calculation blocks.
根据所述备选方向上的计算块的梯度强度,计算所述当前PU在所述备选方向上对应的梯度强度。According to the gradient strength of the calculation block in the candidate direction, the gradient strength corresponding to the current PU in the candidate direction is calculated.
将对应的梯度强度最小的备选方向,确定为所述第二方向。The corresponding candidate direction with the smallest gradient intensity is determined as the second direction.
可选的,所述第二选择模式403,还具体用于:Optionally, the second selection mode 403 is also specifically used for:
对于任一所述计算块,按照所述备选方向,从所述计算块中间隔选择n对像素点对,作为参考像素点对。For any of the calculation blocks, according to the alternative direction, n pairs of pixel point pairs are selected from the calculation block at intervals as reference pixel point pairs.
基于所述参考像素点对中包含的像素点进行差分计算。The difference calculation is performed based on the pixels included in the reference pixel pair.
将所述差分计算的结果,确定为所述计算块在所述备选方向上的梯度强度。The result of the difference calculation is determined as the gradient strength of the calculation block in the candidate direction.
可选的,所述第二选择模式403,还具体用于:Optionally, the second selection mode 403 is also specifically used for:
若所述第一方向与所述第二方向平行,则将所述第一方向表示的备选方向,确定为所述候选方向。If the first direction is parallel to the second direction, the candidate direction indicated by the first direction is determined as the candidate direction.
若所述第一方向与所述第二方向垂直,则选择至少两个所述备选方向,作为所述候选方向。If the first direction is perpendicular to the second direction, at least two of the candidate directions are selected as the candidate directions.
若所述第一方向与所述第二方向之间形成预设角度的夹角,则将所述第一方向表示的备选方向及所述第二方向表示的备选方向,确定为所述候选方向;其中,所述预设角度为除0度及90度之外的角度。If an included angle of a preset angle is formed between the first direction and the second direction, the candidate direction represented by the first direction and the candidate direction represented by the second direction are determined as the candidate direction; wherein, the preset angle is an angle other than 0 degrees and 90 degrees.
可选的,所述第二选择模式403,还具体用于:Optionally, the second selection mode 403 is also specifically used for:
选择所有所述备选方向,确定为所述候选方向。All the candidate directions are selected and determined as the candidate directions.
可选的,所述第三选择模式404,具体用于:Optionally, the third selection mode 404 is specifically used for:
对于任一所述候选方向,以所述候选方向对应的角度模式为中心,按照第一预设步长,从所述对应的角度模式两侧的模式中,等间距选择p个模式,作为第一备选模式。For any of the candidate directions, with the angle pattern corresponding to the candidate direction as the center, according to the first preset step size, select p patterns at equal intervals from the patterns on both sides of the corresponding angle pattern, as the first An alternative mode.
根据所述第一备选模式确定第一候选模式,以及将所述预设编码标准提供的非角度模式确定为第二候选模式。A first candidate mode is determined according to the first candidate mode, and a non-angular mode provided by the preset coding standard is determined as a second candidate mode.
将所述第一候选模式及所述第二候选模式,确定为所述候选模式。The first candidate mode and the second candidate mode are determined as the candidate modes.
可选的,所述第三选择模式404,还具体用于:Optionally, the third selection mode 404 is also specifically used for:
计算所述当前PU在各个所述第一备选模式下的率失真代价。Calculate the rate-distortion cost of the current PU in each of the first candidate modes.
将前q个最大的率失真代价对应的第一备选模式,作为第二备选模式。The first candidate mode corresponding to the first q largest rate-distortion costs is used as the second candidate mode.
将所述第二备选模式两侧相邻的角度模式,确定为所述第一候选模式。An angle mode adjacent to both sides of the second candidate mode is determined as the first candidate mode.
可选的,所述装置40还包括:Optionally, the device 40 further includes:
加入模块,用于将所述角度代表模式及所述第一备选模式,加入所述候选模式。An adding module is used for adding the angle representative mode and the first candidate mode to the candidate mode.
可选的,所述装置40还包括:Optionally, the device 40 further includes:
第二确定模块,用于确定所述候选模式对应的率失真代价。The second determination module is configured to determine the rate-distortion cost corresponding to the candidate mode.
剔除模块,用于若所述候选模式对应的率失真代价大于预设率失真代价阈值,则剔除所述候选模式。A rejection module, configured to reject the candidate mode if the rate-distortion cost corresponding to the candidate mode is greater than a preset rate-distortion cost threshold.
可选的,所述第一选择模式401,具体用于:Optionally, the first selection mode 401 is specifically used for:
以预设角度模式为起点,按照第二预设步长依次从所述预设编码标准提 供的角度模式中等间距选择m个角度模式。Taking the preset angle mode as a starting point, m angle modes are selected from the angle modes provided by the preset coding standard at equal intervals in sequence according to the second preset step size.
将所选择的所述m个角度模式作为所述角度代表模式。The selected m angle patterns are used as the angle representative patterns.
可选的,所述第一确定模式402,具体用于:Optionally, the first determination mode 402 is specifically used for:
计算所述当前PU在各个所述角度代表模式下的率失真代价。A rate-distortion cost for the current PU in each of the angle representation modes is calculated.
将率失真代价最小的角度代表模式对应的备选方向,确定为所述第一方向。The angle with the smallest rate-distortion cost represents the candidate direction corresponding to the mode, and is determined as the first direction.
综上所述,本公开实施例提供的模式选择装置,通过从预设编码标准提供的角度模式中,选择m个角度代表模式,m小于预设编码标准提供的角度模式的数量,将角度代表模式表示的方向作为备选方向,并根据当前预测单元PU在各个角度代表模式下的编码效果参数,从备选方向中选择当前PU对应的第一方向,接着根据第一方向,从备选方向中选择候选方向,候选方向中至少包括第一方向。最后,根据候选方向,从预设编码标准提供的模式中选择候选模式。这样,通过先选择角度代表模式确定出最优模式可能在的候选方向,并仅在该候选方向周围的模式上选择候选模式,即,排除掉存在编码效果较好模式的概率较小的方向,在针对多种角度模式筛选时,仅以候选方向周围的模式,即,部分模式为筛选基础,这样,一定程度上可以减小筛选候选模式时整体需要判断的模式数量,进而降低计算量以及耗时,提高效率。To sum up, the mode selection device provided by the embodiment of the present disclosure selects m angle representative modes from the angle modes provided by the preset coding standard, where m is less than the number of angle modes provided by the preset coding standard, and the angle representative mode is selected. The direction represented by the mode is used as an alternative direction, and according to the coding effect parameters of the current prediction unit PU in each angle representative mode, the first direction corresponding to the current PU is selected from the alternative directions, and then according to the first direction, from the alternative direction Select candidate directions from among the candidate directions, and the candidate directions include at least the first direction. Finally, according to the candidate direction, a candidate mode is selected from the modes provided by the preset coding standard. In this way, the candidate direction in which the optimal mode may be located is determined by first selecting the angle representative mode, and the candidate mode is only selected in the mode around the candidate direction, that is, the direction with a small probability of having a mode with better coding effect is excluded, When screening for multiple angle modes, only the mode around the candidate direction, that is, the partial mode, is the basis for screening. In this way, the number of modes that need to be judged when screening the candidate mode can be reduced to a certain extent, thereby reducing the amount of calculation and consumption. , improve efficiency.
对于上述装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。For the above-mentioned apparatus embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and reference may be made to the partial descriptions of the method embodiments for related parts.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in One place, or it can be distributed over multiple network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment. Those of ordinary skill in the art can understand and implement it without creative effort.
可选的,本公开实施例还提供一种电子设备,电子设备可以包括:处理器、存储器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现上述模式选择方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。Optionally, an embodiment of the present disclosure further provides an electronic device, the electronic device may include: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the When the processor executes the program, each process of the above mode selection method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, details are not repeated here.
可选的,本公开实施例还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,该计算机程序被处理器执行时实现上述模式选择方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。Optionally, an embodiment of the present disclosure further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, each process of the foregoing mode selection method embodiment is implemented, and can To achieve the same technical effect, in order to avoid repetition, details are not repeated here.
例如,图9示出了可以一种电子设备的结构示意图。该电子设备包括处理器510和存储器520。存储器520可以是诸如闪存、电可擦除可编程只读存 储器、硬盘、随机存取存储器(Random Access Memory,RAM)、磁碟、光盘或只读存储器(Read-Only Memory,ROM)之类的电子存储器。存储器520具有用于程序代码的存储空间530。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程序代码载体,参考图10所述的便携式或者固定存储单元。该存储单元可以具有与图9的电子设备中的存储器520类似布置的存储段、存储空间等。通常,存储单元包括计算机可读代码1031’,这些代码当由计算处理设备运行时,导致该计算处理设备执行上面所描述的方法中的各个步骤。For example, FIG. 9 shows a schematic structural diagram of an electronic device. The electronic device includes a processor 510 and a memory 520 . The memory 520 may be something such as flash memory, electrically erasable programmable read-only memory, hard disk, random access memory (RAM), magnetic disk, optical disk, or read-only memory (ROM) or the like electronic storage. Memory 520 has storage space 530 for program codes. These program codes can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks, portable or fixed storage units as described with reference to FIG. 10 . The storage unit may have storage segments, storage spaces, etc. arranged similarly to the memory 520 in the electronic device of FIG. 9 . Typically, the storage unit includes computer readable code 1031' which, when executed by a computing processing device, causes the computing processing device to perform the various steps in the methods described above.

Claims (16)

  1. 一种模式选择方法,其特征在于,所述方法包括:A mode selection method, characterized in that the method comprises:
    从预设编码标准提供的角度模式中,选择m个角度代表模式;所述m小于所述预设编码标准提供的角度模式的数量;From the angle modes provided by the preset coding standard, select m angle representative modes; the m is less than the number of angle modes provided by the preset coding standard;
    将所述角度代表模式表示的方向作为备选方向,并根据当前预测单元在各个所述角度代表模式下的编码效果参数,从所述备选方向中确定所述当前预测单元对应的第一方向;所述第一方向对应的角度代表模式下的编码效果参数满足第一预设条件;Taking the direction represented by the angle representative mode as an alternative direction, and determining the first direction corresponding to the current prediction unit from the alternative directions according to the coding effect parameters of the current prediction unit in each of the angle representative modes ; The encoding effect parameter under the angle representative mode corresponding to the first direction satisfies the first preset condition;
    根据所述第一方向从所述备选方向中选择候选方向;所述候选方向中至少包括所述第一方向;A candidate direction is selected from the candidate directions according to the first direction; the candidate directions include at least the first direction;
    基于所述候选方向周围的模式,从所述预设编码标准提供的模式中选择候选模式。Based on the patterns around the candidate direction, a candidate pattern is selected from patterns provided by the preset coding standard.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述第一方向从所述备选方向中选择候选方向,包括:The method according to claim 1, wherein the selecting a candidate direction from the candidate directions according to the first direction comprises:
    根据所述当前预测单元在各个所述备选方向上的梯度强度,从所述备选方向中选择当前预测单元对应的第二方向;所述第二方向上的梯度强度满足第二预设条件;According to the gradient strength of the current prediction unit in each of the candidate directions, a second direction corresponding to the current prediction unit is selected from the candidate directions; the gradient strength in the second direction satisfies a second preset condition ;
    根据所述第一方向与所述第二方向之间的相对关系,从所述备选方向中选择所述候选方向。The candidate direction is selected from the candidate directions according to the relative relationship between the first direction and the second direction.
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述当前预测单元在各个所述备选方向上的梯度强度,从所述备选方向中选择当前预测单元对应的第二方向,包括:The method according to claim 2, wherein the second direction corresponding to the current prediction unit is selected from the candidate directions according to the gradient strength of the current prediction unit in each of the candidate directions, include:
    将所述当前预测单元划分为至少两个计算块;其中,一个所述计算块包含至少两个像素点;dividing the current prediction unit into at least two calculation blocks; wherein one of the calculation blocks includes at least two pixels;
    对于任一所述备选方向,根据各个所述计算块中包含的像素点的像素值,计算所述计算块在所述备选方向上的梯度强度;For any of the alternative directions, according to the pixel values of the pixel points included in each of the calculation blocks, calculate the gradient strength of the calculation block in the alternative direction;
    根据所述备选方向上的计算块的梯度强度,计算所述当前预测单元在所述备选方向上对应的梯度强度;According to the gradient strength of the calculation block in the candidate direction, calculate the gradient strength corresponding to the current prediction unit in the candidate direction;
    将对应的梯度强度最小的备选方向,确定为所述第二方向。The corresponding candidate direction with the smallest gradient intensity is determined as the second direction.
  4. 根据权利要求3所述的方法,其特征在于,所述根据各个所述计算块中包含的像素点的像素值,计算所述计算块在所述备选方向上的梯度强度,包括:The method according to claim 3, wherein the calculating the gradient strength of the calculation block in the candidate direction according to the pixel value of the pixel point included in each of the calculation blocks comprises:
    对于任一所述计算块,按照所述备选方向,从所述计算块中间隔选择n对像素点对,作为参考像素点对;For any one of the calculation blocks, according to the alternative direction, n pairs of pixel point pairs are selected from the calculation block at intervals as reference pixel point pairs;
    基于所述参考像素点对中包含的像素点进行差分计算;Perform differential calculation based on the pixels included in the reference pixel pair;
    将所述差分计算的结果,确定为所述计算块在所述备选方向上的梯度强度。The result of the difference calculation is determined as the gradient strength of the calculation block in the candidate direction.
  5. 根据权利要求2至3任一所述的方法,其特征在于,所述根据所述第一方向与所述第二方向之间的相对关系,从所述备选方向中选择所述候选方向,包括:The method according to any one of claims 2 to 3, wherein the selecting the candidate direction from the candidate directions according to the relative relationship between the first direction and the second direction, include:
    若所述第一方向与所述第二方向平行,则将所述第一方向表示的备选方向,确定为所述候选方向;If the first direction is parallel to the second direction, determining the candidate direction represented by the first direction as the candidate direction;
    若所述第一方向与所述第二方向垂直,则选择至少两个所述备选方向,作为所述候选方向;If the first direction is perpendicular to the second direction, selecting at least two of the candidate directions as the candidate directions;
    若所述第一方向与所述第二方向之间形成预设角度的夹角,则将所述第一方向表示的备选方向及所述第二方向表示的备选方向,确定为所述候选方向;其中,所述预设角度为除0度及90度之外的角度。If an included angle of a preset angle is formed between the first direction and the second direction, the candidate direction represented by the first direction and the candidate direction represented by the second direction are determined as the candidate direction; wherein, the preset angle is an angle other than 0 degrees and 90 degrees.
  6. 根据权利要求5所述的方法,其特征在于,所述选择至少两个所述备选方向,作为所述候选方向,包括:The method according to claim 5, wherein the selecting at least two of the candidate directions as the candidate directions comprises:
    选择所有所述备选方向,确定为所述候选方向。All the candidate directions are selected and determined as the candidate directions.
  7. 根据权利要求1所述的方法,其特征在于,所述基于所述候选方向周围的模式,从预设编码标准提供的模式中选择候选模式,包括:The method according to claim 1, wherein the selecting a candidate pattern from patterns provided by a preset coding standard based on patterns around the candidate direction comprises:
    对于任一所述候选方向,以所述候选方向对应的角度模式为中心,按照第一预设步长,从所述对应的角度模式两侧的模式中,等间距选择p个模式,作为第一备选模式;For any of the candidate directions, with the angle pattern corresponding to the candidate direction as the center, according to the first preset step size, select p patterns at equal intervals from the patterns on both sides of the corresponding angle pattern, as the first an alternative mode;
    根据所述第一备选模式确定第一候选模式,以及将所述预设编码标准提供的非角度模式确定为第二候选模式;determining a first candidate mode according to the first candidate mode, and determining a non-angular mode provided by the preset coding standard as a second candidate mode;
    将所述第一候选模式及所述第二候选模式,确定为所述候选模式。The first candidate mode and the second candidate mode are determined as the candidate modes.
  8. 根据权利要求7所述的方法,其特征在于,所述根据所述第一备选模式确定第一候选模式,包括:The method according to claim 7, wherein the determining the first candidate mode according to the first candidate mode comprises:
    计算所述当前预测单元在各个所述第一备选模式下的率失真代价;calculating the rate-distortion cost of the current prediction unit in each of the first candidate modes;
    将前q个最大的率失真代价对应的第一备选模式,作为第二备选模式;The first candidate mode corresponding to the first q largest rate-distortion costs is used as the second candidate mode;
    将所述第二备选模式两侧相邻的角度模式,确定为所述第一候选模式。An angle mode adjacent to both sides of the second candidate mode is determined as the first candidate mode.
  9. 根据权利要求7所述的方法,其特征在于,所述将所述第一候选模式及所述第二候选模式,确定为所述候选模式之后,所述方法还包括:The method according to claim 7, wherein after the first candidate mode and the second candidate mode are determined as the candidate modes, the method further comprises:
    将所述角度代表模式及所述第一备选模式,加入所述候选模式。The angle representative mode and the first candidate mode are added to the candidate mode.
  10. 根据权利要求7-9任一所述的方法,其特征在于,所述根据所述候选方向周围的模式,从预设编码标准提供的模式中选择候选模式之后,所述方法还包括:The method according to any one of claims 7-9, wherein after selecting the candidate mode from the modes provided by the preset coding standard according to the mode around the candidate direction, the method further comprises:
    确定所述候选模式对应的率失真代价;determining a rate-distortion cost corresponding to the candidate mode;
    若所述候选模式对应的率失真代价大于预设率失真代价阈值,则剔除所 述候选模式。If the rate-distortion cost corresponding to the candidate mode is greater than a preset rate-distortion cost threshold, the candidate mode is eliminated.
  11. 根据权利要求1所述的方法,其特征在于,所述从预设编码标准提供的角度模式中,选择m个角度代表模式,包括:The method according to claim 1, wherein the selecting m angle representative modes from angle modes provided by a preset coding standard, comprising:
    以预设角度模式为起点,按照第二预设步长依次从所述预设编码标准提供的角度模式中等间距选择m个角度模式;Taking the preset angle mode as a starting point, selecting m angle modes at equal intervals from the angle modes provided by the preset coding standard in sequence according to the second preset step size;
    将所选择的所述m个角度模式作为所述角度代表模式。The selected m angle patterns are used as the angle representative patterns.
  12. 根据权利要求1或11所述的方法,其特征在于,所述根据当前预测单元在各个所述角度代表模式下的编码效果参数,从所述备选方向中确定当前预测单元对应的第一方向,包括:The method according to claim 1 or 11, wherein the first direction corresponding to the current prediction unit is determined from the candidate directions according to coding effect parameters of the current prediction unit in each of the angle representative modes ,include:
    计算所述当前预测单元在各个所述角度代表模式下的率失真代价;calculating the rate-distortion cost of the current prediction unit in each of the angle representation modes;
    将率失真代价最小的角度代表模式对应的备选方向,确定为所述第一方向。The angle with the smallest rate-distortion cost represents the candidate direction corresponding to the mode, and is determined as the first direction.
  13. 一种模式选择装置,其特征在于,所述装置包括:A mode selection device, characterized in that the device comprises:
    第一选择模式,用于从预设编码标准提供的角度模式中,选择m个角度代表模式;所述m小于所述预设编码标准提供的角度模式的数量;a first selection mode, used for selecting m angle representative modes from the angle modes provided by the preset coding standard; the m is less than the number of angle modes provided by the preset coding standard;
    第一确定模式,用于将所述角度代表模式表示的方向作为备选方向,并根据当前预测单元在各个所述角度代表模式下的编码效果参数,从所述备选方向中确定当前预测单元对应的第一方向;所述第一方向对应的角度代表模式下的编码效果参数满足第一预设条件;The first determination mode is used to take the direction represented by the angle representative mode as an alternative direction, and determine the current prediction unit from the alternative directions according to the coding effect parameters of the current prediction unit in each of the angle representative modes The corresponding first direction; the angle corresponding to the first direction represents that the encoding effect parameter in the mode satisfies the first preset condition;
    第二选择模式,用于根据所述第一方向从所述备选方向中选择候选方向;所述候选方向中至少包括所述第一方向;a second selection mode, configured to select a candidate direction from the candidate directions according to the first direction; the candidate directions include at least the first direction;
    第三选择模式,用于基于所述候选方向周围的模式,从所述预设编码标准提供的模式中选择候选模式。The third selection mode is used to select a candidate mode from modes provided by the preset coding standard based on modes around the candidate direction.
  14. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现如权利要求1至12任一所述的模式选择方法。A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the mode selection method according to any one of claims 1 to 12 is implemented.
  15. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    处理器、存储器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现如权利要求1-12任一所述的模式选择方法。A processor, a memory, and a computer program stored on the memory and executable on the processor, characterized in that, when the processor executes the program, the mode according to any one of claims 1-12 is implemented Method of choosing.
  16. 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算处理设备上运行时,导致所述计算处理设备执行根据权利要求1-12任一所述的模式选择方法。A computer program comprising computer readable code which, when run on a computing processing device, causes the computing processing device to perform the mode selection method according to any one of claims 1-12.
PCT/CN2021/094198 2020-07-31 2021-05-17 Mode selection method and apparatus, computer-readable storage medium and electronic device WO2022022013A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010761465.4 2020-07-31
CN202010761465.4A CN111988605B (en) 2020-07-31 2020-07-31 Mode selection method, mode selection device, computer readable storage medium and electronic device

Publications (1)

Publication Number Publication Date
WO2022022013A1 true WO2022022013A1 (en) 2022-02-03

Family

ID=73445001

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/094198 WO2022022013A1 (en) 2020-07-31 2021-05-17 Mode selection method and apparatus, computer-readable storage medium and electronic device

Country Status (2)

Country Link
CN (1) CN111988605B (en)
WO (1) WO2022022013A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111988605B (en) * 2020-07-31 2023-11-21 广州市百果园信息技术有限公司 Mode selection method, mode selection device, computer readable storage medium and electronic device
CN115550645A (en) * 2022-12-02 2022-12-30 杭州未名信科科技有限公司 Method and device for determining intra-frame prediction mode, storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104954788A (en) * 2014-03-27 2015-09-30 浙江大华技术股份有限公司 HEVC (High Efficiency Video Coding) intra-frame prediction mode selection method and device
US20160309145A1 (en) * 2015-04-16 2016-10-20 Ajou University Industry-Academic Cooperation Foundation Hevc encoding device and method for determining intra-prediction mode using the same
CN110198442A (en) * 2018-12-27 2019-09-03 腾讯科技(深圳)有限公司 A kind of intra-frame prediction method, device and storage medium for Video coding
CN111988605A (en) * 2020-07-31 2020-11-24 广州市百果园信息技术有限公司 Mode selection method and device, computer readable storage medium and electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104284186A (en) * 2014-09-24 2015-01-14 复旦大学 Fast algorithm suitable for HEVC standard intra-frame prediction mode judgment process
US10142626B2 (en) * 2014-10-31 2018-11-27 Ecole De Technologie Superieure Method and system for fast mode decision for high efficiency video coding
CN110049339B (en) * 2018-01-16 2023-02-17 腾讯科技(深圳)有限公司 Prediction direction selection method and device in image coding and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104954788A (en) * 2014-03-27 2015-09-30 浙江大华技术股份有限公司 HEVC (High Efficiency Video Coding) intra-frame prediction mode selection method and device
US20160309145A1 (en) * 2015-04-16 2016-10-20 Ajou University Industry-Academic Cooperation Foundation Hevc encoding device and method for determining intra-prediction mode using the same
CN110198442A (en) * 2018-12-27 2019-09-03 腾讯科技(深圳)有限公司 A kind of intra-frame prediction method, device and storage medium for Video coding
CN111988605A (en) * 2020-07-31 2020-11-24 广州市百果园信息技术有限公司 Mode selection method and device, computer readable storage medium and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
GWON DAEHYEOK; CHOI HAECHUL; YOUN JONGHEE M.: "HEVC fast intra mode decision based on edge and SATD cost", 2015 ASIA PACIFIC CONFERENCE ON MULTIMEDIA AND BROADCASTING, IEEE, 23 April 2015 (2015-04-23), pages 1 - 5, XP033195995, DOI: 10.1109/APMediaCast.2015.7210287 *
朱威 等 (ZHU, WEI ET AL.): "低复杂度的HEVC帧内编码模式决策算法 (Low Complexity Mode Decision Algorithm for HEVC Intra Coding)", 小型微型计算机系统 (JOURNAL OF CHINESE COMPUTER SYSTEMS), 31 December 2017 (2017-12-31) *

Also Published As

Publication number Publication date
CN111988605A (en) 2020-11-24
CN111988605B (en) 2023-11-21

Similar Documents

Publication Publication Date Title
CN110572655B (en) Method and equipment for encoding and decoding point cloud attribute based on neighbor weight parameter selection and transmission
CN104244007B (en) Image coding method and device and decoding method and device
US10003792B2 (en) Video encoder for images
TWI520579B (en) Picture coding supporting block partitioning and block merging
US9451266B2 (en) Optimal intra prediction in block-based video coding to calculate minimal activity direction based on texture gradient distribution
WO2018010492A1 (en) Rapid decision making method for intra-frame prediction mode in video coding
RU2518635C2 (en) Method and apparatus for encoding and decoding coding unit of picture boundary
WO2022022013A1 (en) Mode selection method and apparatus, computer-readable storage medium and electronic device
CN104735452B (en) By the method and apparatus using big converter unit image to be encoded and decodes
CN113766228A (en) Point cloud compression method, encoder, decoder, and storage medium
CN111242997A (en) Filter-based point cloud attribute prediction method and device
US11936909B2 (en) Prediction method, encoder, decoder, and computer storage medium
CN116033149A (en) Method and device for predicting video image component and computer storage medium
CN115118977B (en) Intra-frame prediction encoding method, system, and medium for 360-degree video
KR20190090867A (en) Intra prediction mode based image processing method and apparatus therefor
CN110677644B (en) Video coding and decoding method and video coding intra-frame predictor
CN112770120B (en) 3D video depth map intra-frame rapid coding method based on depth neural network
WO2021108969A1 (en) Attribute information prediction method, encoder, decoder and storage medium
KR20220123258A (en) Intra prediction method, apparatus, encoder, decoder and storage medium
CN109688411B (en) Video coding rate distortion cost estimation method and device
JP7411785B2 (en) Interpolation filtering method and device, computer program and electronic device for intra prediction
CN111918059B (en) Hardware-friendly regression tree-based intra-frame prediction mode decision method and device
CN114666579A (en) Video coding method and device, electronic equipment and storage medium
CN116156174B (en) Data encoding processing method, device, computer equipment and storage medium
EP4354858A1 (en) Encoding method and apparatus using inter-frame prediction, device, and readable storage medium

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: 21850762

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: 21850762

Country of ref document: EP

Kind code of ref document: A1