WO2020125649A1 - Data processing method and apparatus, and storage medium - Google Patents

Data processing method and apparatus, and storage medium Download PDF

Info

Publication number
WO2020125649A1
WO2020125649A1 PCT/CN2019/126075 CN2019126075W WO2020125649A1 WO 2020125649 A1 WO2020125649 A1 WO 2020125649A1 CN 2019126075 W CN2019126075 W CN 2019126075W WO 2020125649 A1 WO2020125649 A1 WO 2020125649A1
Authority
WO
WIPO (PCT)
Prior art keywords
frame image
current frame
motion vector
ctu
vector parameter
Prior art date
Application number
PCT/CN2019/126075
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 WO2020125649A1 publication Critical patent/WO2020125649A1/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/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/136Incoming video signal characteristics or properties
    • H04N19/137Motion inside a coding unit, e.g. average field, frame or block difference
    • H04N19/139Analysis of motion vectors, e.g. their magnitude, direction, variance or reliability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/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/154Measured or subjectively estimated visual quality after decoding, e.g. measurement of distortion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
    • H04N19/96Tree coding, e.g. quad-tree coding

Definitions

  • the present disclosure relates to data processing technology, for example, to a data processing method, device, and storage medium.
  • the video resolution and video bitstream are also expanding.
  • the video stream is the same.
  • the larger the video stream the smaller the video compression ratio, the higher the picture quality, and the greater the network bandwidth required. This is bound to bring great pressure on the network bandwidth. Therefore, without increasing the network bandwidth, how to improve the encoding quality of video files by adjusting the video stream becomes very important.
  • the related art can only improve the coding quality of video streams with still and small motion scenes through coding control algorithms, but cannot improve the coding quality of video streams with medium motion characteristics.
  • Embodiments of the present invention are expected to provide a data processing method, device, and storage medium, which can improve the encoding quality of a video bitstream.
  • An embodiment of the present invention provides a data processing method.
  • the method includes:
  • the coding parameters of the current frame image are adjusted.
  • An embodiment of the present invention provides a data processing device.
  • the device includes:
  • An obtaining unit configured to obtain the motion vector parameters of the current frame image corresponding to the reference frame image according to the output result of the reference frame image;
  • a determining unit configured to determine the motion level corresponding to the target area in the current frame image according to the motion vector parameter
  • the adjusting unit is configured to adjust the encoding parameters of the current frame image when the motion level meets the encoding adjustment strategy.
  • An embodiment of the present invention provides a data processing apparatus.
  • the apparatus includes: a memory and a processor;
  • the memory is configured to store a computer program that can run on the processor
  • the processor is configured to execute the steps of the above data processing method when running the computer program.
  • An embodiment of the present invention also provides a computer-readable storage medium that stores computer-executable instructions, and the computer-executable instructions are used to perform the steps of the foregoing data processing method.
  • Embodiments of the present invention provide a data processing method, device, and storage medium.
  • the implementation complexity of the hardware can be reduced;
  • adjusting the coding parameters of the current frame image can significantly improve the coding quality of the current frame image with little bandwidth increase.
  • FIG. 1 is a schematic flowchart of a data processing method in an embodiment of the present invention
  • FIG. 2 is a schematic diagram of the overall process of the data processing method in the embodiment of the present invention.
  • FIG. 3 is a schematic flowchart of adjusting frame-level parameters of an image of a current frame in an embodiment of the present invention
  • FIG. 4 is a schematic flowchart of adjusting CTU (Coding Tree Unit) level parameters of a current frame image in an embodiment of the present invention
  • FIG. 5 is a schematic flow chart of collaborative adjustment of the frame-level parameters and CTU-level parameters of the current frame image in the embodiment of the present invention
  • FIG. 6 is a first schematic diagram of the structural composition of a data processing device in an embodiment of the present invention.
  • FIG. 7 is a second schematic diagram of the structural composition of the data processing device in the embodiment of the present invention.
  • FIG. 1 is a schematic flowchart of a data processing method in an embodiment of the present invention. As shown in FIG. 1, the method includes:
  • Step 101 Obtain the motion vector parameters of the current frame image corresponding to the reference frame image according to the output result of the reference frame image;
  • the method is mainly applicable to an electronic device with a video image encoding function.
  • the electronic device When processing the image signal of the current frame image, the electronic device usually divides the current frame image into multiples according to a preset image division unit Coding Tree Unit (CTU), the size of each CTU can be 64x64. Then, use the coding region corresponding to at least one CTU as the region A in the current frame image, and search for the region A′ that matches the content of the region A in the reference frame image corresponding to the current frame image according to the content of the region A, and The location of the area A'is determined as the best matching position of the area A in the reference frame image, and the motion statistical information corresponding to the area A'is used as the output result of the reference frame image.
  • CTU image division unit Coding Tree Unit
  • the motion statistical information may be the offset of the area A and the area A′ in the horizontal and vertical directions.
  • the matching of the area A and the area A′ means that the error between the area A and the area A′ is the smallest, and the error may be the sum of squared errors (Sum of Squared Error, SSE), absolute Sum of errors (Sum of Absolute Difference, SAD) or sum of absolute transformation differences (Sum of Absolute Transformed Difference, SATD), etc.
  • the electronic device After the electronic device obtains the output result of the reference frame image, it uses the output result to perform motion estimation (Vector Estimator, VE) on the area A of the current frame image to obtain the motion vector parameter of the area A.
  • motion estimation Vector Estimator, VE
  • the motion vector parameters include the offset of the motion estimation value of the area A in the horizontal direction and the offset of the motion estimation value in the vertical direction.
  • the numerical values of the offset of the motion estimation value in the horizontal direction and the offset of the motion estimation value in the vertical direction of the area A are not in the unit of pixel size, but in the image signal processing module (Image) Processing (ISP)
  • the internally set size is in units.
  • the offset of the motion estimation value of the area A in the horizontal direction can be expressed as offset_x
  • the VE value of the area A in the vertical direction can be expressed as: offset_y.
  • the entire coding region corresponding to the current frame image may also be used as the region A.
  • the region A may include multiple CTUs, and the size of each CTU is equal.
  • the motion vector parameter of the region A may include motion vector parameter components corresponding to multiple CTUs.
  • Step 102 Determine the motion level corresponding to the target area in the current frame image according to the motion vector parameter
  • the coding region corresponding to at least one CTU among the multiple CTUs of the current frame image may be determined as the target region, or the entire coding region corresponding to the current frame image may be determined as the target region.
  • the motion vector parameter when the electronic device determines the coding region corresponding to at least one CTU in the current frame image as the target region, the motion vector parameter includes the motion vector parameter component corresponding to at least one CTU, and the motion vector parameter corresponding to the at least one CTU may be A preset motion vector parameter is compared with a second preset motion vector parameter to obtain a first comparison result, where the first preset motion vector parameter is greater than the second preset motion vector parameter; then, based on the first comparison result, it is determined At least one CTU corresponds to the exercise level.
  • the first preset motion vector parameter and the second preset motion vector parameter value are values customized before encoding, and are generally set according to the scene type and experience value used, or obtained by training.
  • the motion vector parameter corresponding to at least one CTU when it is determined that the motion vector parameter corresponding to at least one CTU is less than the second preset motion vector parameter, it is determined that the motion level corresponding to the at least one CTU is a smaller motion; if, according to the first comparison result, it is determined When the motion vector parameter corresponding to at least one CTU is greater than the first preset motion vector parameter, it is determined that the motion level corresponding to the at least one CTU is excessive motion; if, according to the first comparison result, it is determined that the motion vector parameter corresponding to the at least one CTU is less than Or equal to the first preset motion vector parameter and greater than or equal to the second preset motion vector parameter, it is determined that the motion level corresponding to at least one CTU is medium motion. In this way, the coding parameters of a certain CTU in the current frame image can be fine-tuned by determining the motion level corresponding to a certain CTU of the current frame image.
  • the motion vector parameter includes the motion vector parameter component corresponding to each CTU among the multiple CTUs of the current frame image, and each of the multiple CTUs
  • the motion vector parameter components corresponding to the CTU are compared with the first preset motion vector parameter and the second preset motion vector parameter respectively to obtain a second comparison result; then, according to the second comparison result, the first preset motion will be less than or equal to
  • the vector parameter and the CTU corresponding to the target motion vector parameter greater than or equal to the second preset motion vector parameter is determined to be the target CTU in the current frame image that meets the coding adjustment strategy; then the target CTU is accounted for by all CTUs in the current frame image
  • the ratio is compared with the preset ratio to obtain a third comparison result; and according to the third comparison result, the motion level corresponding to the target area in the current frame image is determined.
  • the motion level of the current frame image is considered to be medium motion
  • the motion level of the current frame image is considered to be excessive.
  • Large motion when the third comparison result indicates that the proportion of the total number of CTUs with smaller motion characteristics in the current frame image is greater than the preset threshold for the proportion of smaller motion characteristics, the motion level of the current frame image is considered to be Less movement. In this way, the encoding parameters of the current frame image can be fine-tuned by determining the motion level of the current frame image.
  • Step 103 When the motion level meets the coding adjustment strategy, adjust the coding parameters of the current frame image.
  • the coding adjustment strategy may be: when the motion level is a higher motion characteristic or a smaller motion characteristic, the coding parameters of the current frame image are not adjusted; when the motion level is a medium motion characteristic, Adjust the image encoding parameters of the current frame.
  • the encoding parameters of the current frame image can be adjusted in at least one of the following ways: increase the number of second encoding bits corresponding to the target CTU in the current frame image and decrease the QP (Quantization Parameters) corresponding to the target CTU, quantization parameter )value.
  • the motion vector parameter component of the current CTU in the current frame image is: Motion_cur, according to the frame type, pixel distribution area, image scene and other conditions of the current frame image, two first preset motions indicating the size of the current CTU motion vector are set Vector parameter: Motion_Thred_High and the second preset motion vector parameter: Motion_Thred_Low.
  • the first preset motion vector parameter and the second preset motion vector parameter respectively record the quantized value of the motion vector.
  • the first comparison result characterizes: Motion_cur ⁇ Motion_Thred_Low, it is considered that the current CTU motion level belongs to a smaller motion, and the current CTU encoding parameters of the current frame image do not need to be adjusted, and still can be encoded according to the conventional encoding parameters.
  • the conventional coding control algorithm can already do better, so there is no need to re-encode and adjust video streams with smaller motion characteristics. If the first comparison result signifies: Motion_cur>Motion_Thred_High, it is considered that the current CTU motion level belongs to excessive motion, and there is no need to adjust the current CTU level coding parameters of the current frame image, and it can still be coded according to conventional coding parameters.
  • the encoding parameters of the current frame image can be adjusted in at least one of the following ways: increase the number of first encoded bits corresponding to the current frame image and decrease the QP value corresponding to the current frame image.
  • the frame type pixel distribution area, image scene and other conditions of the current frame image
  • set three thresholds representing the proportion of each CTU in the current frame image among all CTUs: Frame_High, Frame_Mid, and Frame_Low.
  • the percentage thresholds respectively record the percentages of the CTUs whose motion levels are "excessive motion, medium motion, and small motion" in all CTUs in the current frame image, and the recording range of this percentage can be 0 to 1.
  • the motion characteristic of each CTU in the current frame image needs to be calculated first.
  • the current frame image can be obtained by comparing the motion vector parameter component (Motion_cur) of the current CTU in the current frame image with the first preset motion vector parameter (Motion_Thred_High) and the second preset motion vector parameter (Motion_Thred_Low) Movement characteristics of each CTU.
  • the motion vector parameter component of the current CTU is: Motion_cur
  • two first preset motion vector parameters representing the size of the current CTU motion vector are set according to the frame type, pixel distribution area, image scene, and other conditions of the current frame image: Motion_Thred_High and The second preset motion vector parameter: Motion_Thred_Low, wherein the first preset motion vector parameter and the second preset motion vector parameter respectively record the quantized values of the motion vector.
  • Motion_Thred_High 2500
  • Motion_Thred_Low 200
  • the motion level of the current frame image is basically at rest , Small motion, the encoding parameters of the current frame image are not adjusted. This is because for frame images with smaller motion characteristics, the conventional coding control algorithm can already do better, so there is no need to re-encode and adjust video streams with smaller motion characteristics.
  • the current frame motion is considered to be very violent Adjust the encoding parameters of the frame image. This is because for frame images with excessive motion characteristics, due to the charge-coupled device (CCD) or complementary metal oxide semiconductor (Complementary Metal Oxide Semiconductor (CMOS)) chip in the image sensor, the corresponding The accurate motion vector parameters are obtained in the reference frame image of, so it is of little significance to improve the encoding quality of the distorted image.
  • CCD charge-coupled device
  • CMOS complementary metal oxide semiconductor
  • the third comparison result indicates that the total number of CTUs in the current frame whose motion level belongs to moderate motion characteristics accounts for the total number of all CTUs in the current frame image> ratio threshold (Frame_Mid), it means that the image sensor in the electronic device can start from the current frame image More accurate motion vector parameters are obtained in the corresponding reference frame image, then the encoding parameters of the current frame image are considered suitable for adjustment.
  • the number of all CTUs in the current frame image is 100.
  • the motion vector parameter components of each CTU with preset thresholds (Motion_Thred_High and Motion_Thred_Low)
  • the level of motion belongs to medium sports, and then, by comparing the proportion of all CTUs in the current frame image of the 51 CTUs with Frame_Mid, the proportion of all CTUs in the current frame image of the 51 CTUs is greater than the threshold of Frame_Mid .
  • the encoding parameters of the current frame image can be adjusted in at least one of the following ways: increasing the number of first encoded bits corresponding to the current frame image, decreasing the QP value corresponding to the current frame image, and increasing the current frame image The number of second coded bits corresponding to the target CTU, and decreasing the QP value corresponding to the target CTU.
  • the encoding parameters of the current frame image can be adjusted in at least one of the following ways: increase the first corresponding to the current frame image The number of coded bits, decrease the QP value corresponding to the current frame image, increase the number of second coded bits corresponding to the target CTU in the current frame image, and decrease the QP value corresponding to the target CTU.
  • the electronic device when the electronic device adjusts the encoding parameters of the current frame image by reducing the QP value corresponding to the current frame image, the electronic device may be based on the target encoding bit number allocated to the current frame image and the current frame image.
  • the number of CTUs increases the number of second encoded bits corresponding to each CTU in the current frame image; then, decreases the QP value corresponding to the current frame image according to the increased number of second encoded bits.
  • the electronic device when adjusting the number of first encoded bits corresponding to the current frame image, may adjust the codeword allocated to the current frame image according to the motion level of the current frame image.
  • the electronic device may calculate the target bit number corresponding to each frame image in the video image according to the target bit rate set by the user on the video image.
  • the code rate control algorithm since the number of bits corresponding to the I-frame image is usually more than that of the P-frame image, the number of bits in the I-frame image is equivalent to the average number of bits of all the frame images and needs to be multiplied by a single digit N, where N is greater than 1. Adjust the size of the N value to change the code word assigned to the current frame image.
  • the codeword assigned to the current frame image can be increased to ensure the subjective quality of the current frame image, and N can be increased by 1; if the current video frame sequence has no motion level or the motion level is When the motion is small, the previous frame image of the current frame image needs to consume less codewords, and the codeword of the current frame image can be appropriately increased, especially the I frame, then N can be increased by 1 on the original basis; When the scene is bursty, the encoding parameters of the current frame image can also be adjusted in real time, especially the P frame, to avoid the lag of the conventional control algorithm.
  • the I-frame image refers to an image whose primary_pic_type (basic frame type) value is 0;
  • the P-frame image refers to an image whose primary_pic_type value is 1.
  • a video frame sequence is a collection of frame images that contains more than one frame image. The video frame sequence can be from the first frame image to the Mth frame image, M is greater than 1, or from the 100th frame image to the Mth frame image, M Greater than 100; you can also customize the video frame sequence without considering the codeword required for the adjustment of the frame image after the current frame image.
  • the electronic device may obtain the average value of each pixel in the current frame image by dividing the target bit number obtained by the current frame image by the resolution of the current frame image
  • the target bit (BitsPerPerPixel, BPP), here, the target bit obtained by each pixel refers to the number of bits used to store each pixel, is used to measure the resolution of the image, also known as the pixel of the image depth.
  • the Lagrangian factor corresponding to the current frame image is calculated from the target bits obtained by averaging each pixel in the current frame image, so that the QP value of the current frame image is calculated according to the calculated Lagrange factor.
  • the following formula 1) calculates the target BPP obtained by averaging each pixel in the current frame image:
  • Target Bits refers to the target number of bits obtained by averaging each frame of the image in the current image sequence.
  • the target bits are obtained by dividing the total number of bits per second by the total number of frames per second.
  • N is a custom multiple
  • W is the width of the current frame image
  • H is the height of the current frame image. If the current frame image is not the first frame image, the values of W and H can be input by the front-level module corresponding to the current frame image. If the current frame image is the first frame image, the values of W and H are input by the system.
  • ⁇ and ⁇ are model parameters, and the values of ⁇ and ⁇ will be continuously updated according to the actual encoding result of the previous frame image of the current frame image, after obtaining ⁇ , the QP of the current frame image is calculated according to the following formula 3).
  • the calculation method of the QP of the current frame image is:
  • the electronic device when adjusting the number of first encoded bits corresponding to the current frame image, may also adjust the QP value of the current frame image according to the motion level of the current frame image.
  • the motion level of the current frame image belongs to medium motion, or the motion level of a CTU in the current frame image belongs to moderate motion, it means that the current frame image can also be added by a small amount of codewords through more refined processing To significantly improve the subjective quality, then it is necessary to reduce the QP value of the current frame image calculated above.
  • the overall motion level of the current frame image belongs to smaller motion or excessive motion, it means that the subjective quality of the current frame image cannot be significantly improved by more fine-grained processing by adding a small number of codewords, then there is no need Adjust the QP value of the current frame image calculated above.
  • the QP value of the current frame image is only fine-tuned.
  • the initial value of the quantization parameter of the current frame image can be obtained from the above three formulas. If the current frame image is to be adjusted for encoding parameters, the QP value of the current frame image can be reduced by 1 on the original basis, otherwise, the QP value of the current frame image constant.
  • the electronic device adjusts at least one of the second coded bit number corresponding to the target CTU of the current frame image and the QP value corresponding to the target CTU in the current frame image in the same manner as the current frame.
  • the method of adjusting the number of first encoded bits corresponding to the image is the same as the method of adjusting at least one of the QP values corresponding to the current frame image.
  • the target bit number of the CTU, the QP value of the target CTU can be reduced by 1 on the original basis; if the motion level of the target CTU in the current frame image belongs to a small motion or an excessive motion, the target bit number and QP value of the target CTU are not used Adjustment.
  • the present invention in order to avoid an excessive difference between the actual code rate and the target code rate, it is possible to choose to adjust only the first encoded bit number of the current frame image and the QP of the current frame image, or only adjust the first CTU of the current frame image. Two coded bits and the QP value of the target CTU.
  • the coding parameters of the current frame image or the CTU in the current frame image can be adjusted. It can significantly improve the encoding quality of the current frame image with little bandwidth increase.
  • FIG. 2 is a schematic flowchart of a data processing method in an embodiment of the present invention. As shown in Figure 2, the process is as follows:
  • Step 201 the pre-level module outputs data
  • the preceding module may be an image signal processing (ISP) module of a reference frame image corresponding to the current frame image.
  • the output data of the pre-module includes data information of the video image and global motion statistics information of the video image.
  • the global motion statistics information may be motion information corresponding to all frame images in the video image.
  • Step 202 After saving the relevant data in the output data, start encoding the current frame image
  • the current frame image is divided into multiple custom-sized CTU regions according to the preset image division unit, and the global motion statistics information output by the previous module is filtered according to the content of each CTU to obtain the The content matches the target area.
  • the motion statistical information corresponding to the target area is used to perform motion estimation on the corresponding CTU in the current frame image to obtain the motion vector parameter of the CTU.
  • the current frame image is the nth frame in the video sequence
  • the reference frame image corresponding to the current frame image is the n-1th frame in the video sequence.
  • the content matching means that the error between the content of the area A and the content of the area A'is less than the preset threshold.
  • Step 203 Determine whether the motion characteristic of the target area in the current frame image is medium motion
  • the target area may be one or more CTUs in the current frame image, or may be the current frame image, or may be one or more slices in the current frame image.
  • the coding area corresponding to at least one CTU in the current frame image may be determined as the target area, or the entire coding area corresponding to the current frame image may be determined as the target area, or the current frame image may be divided into slices, and one slice contains one slice (segment) or a series of slices beginning with an independent slice (segment), a slice is composed of a series of coding trees (coding tree units), referred to as CTU (equivalent to the previous macroblock concept). In other words, the coding area corresponding to a slice is determined as the target area.
  • the motion vector parameter corresponding to the at least one CTU may be compared with the first preset motion vector parameter and the second preset motion vector parameter, respectively To obtain a first comparison result, where the first preset motion vector parameter is greater than the second preset motion vector parameter; when the first comparison result indicates that the motion vector parameter corresponding to at least one CTU in the current frame image is less than or equal to the first preset
  • step 205 is performed; otherwise, step 204 is performed.
  • the motion vector parameter component corresponding to each CTU may be compared with the first preset motion vector parameter and the second preset motion vector parameter, respectively To obtain the second comparison result; then, according to the second comparison result, the CTU corresponding to the target motion vector parameter less than or equal to the first preset motion vector parameter and greater than or equal to the second preset motion vector parameter is determined as the current The target CTU in the frame image that meets the coding adjustment strategy; then compare the proportion of the target CTU in the current frame image with all preset CTUs to obtain the third comparison result; when the third comparison result represents the motion level in the current frame When the ratio of the total number of CTUs belonging to medium motion characteristics to the total number of all CTUs in the current frame image> the ratio threshold (Frame_Mid), it means that the image sensor in the electronic device can get more accurate motion from the reference frame image corresponding to the current frame image For vector parameters, then the encoding parameters of the current
  • step 204 the target number of bits in the current area remains unchanged.
  • Step 205 Adjust the target number of bits in the current area.
  • the encoding parameter of the current frame image can be adjusted in at least one of the following ways: increase the number of second encoding bits corresponding to the target CTU in the current frame image and decrease the QP value corresponding to the target CTU.
  • the encoding parameters of the current frame image can also be adjusted in at least one of the following ways: increase the number of first encoded bits corresponding to the current frame image and decrease the QP value corresponding to the current frame image.
  • Step 206 Calculate, adjust and limit the QP value of the current area
  • the limiting range of the QP value of the current region is usually 0-51. In one embodiment, the limiting range can be customized between 16-48. When the number of target bits increases, the QP value will decrease or stay the same.
  • the QP value is only fine-tuned. Therefore, after obtaining the adjusted QP value, it is also necessary to compare the adjusted QP value with the QP value before adjustment, and judge whether the adjusted QP value is within the preset adjustment amplitude according to the comparison result. When the adjusted QP value is not within the preset adjustment amplitude, the adjusted QP value needs to be adjusted to the preset adjustment amplitude.
  • the electronic device also calculates the adjusted QP value.
  • the current QP value is determined by the calculation result, it can be adjusted in one step.
  • the QP value of the current frame image can be based on the original Decrease by one, otherwise, the QP value of the current frame image does not change.
  • the method of calculating the QP value can refer to the above formula 1, formula 2 and formula 3).
  • the QP value of the current frame image is adjusted according to the motion level of the current frame image
  • the motion level of the current frame image is found to be moderate motion, or the motion level of a CTU in the current frame image is moderate motion, it indicates that the current frame
  • the image can also be improved through more refined processing to add a small number of codewords to significantly improve the subjective quality, then it is necessary to reduce the QP value of the current frame image calculated above.
  • the overall motion level of the current frame image belongs to smaller motion or excessive motion, it means that the subjective quality of the current frame image cannot be significantly improved by more fine-grained processing by adding a small number of codewords, then there is no need Adjust the QP value of the current frame image calculated above.
  • Step 207 encode the target area of the current frame image
  • Step 208 Determine whether the encoding of the current frame image ends
  • step 209 is performed; when it is determined that the encoding of the current frame image has not ended, step 210 is performed.
  • Step 209 Determine whether the encoding of the current frame sequence ends
  • step 211 When it is determined that the encoding of the current frame sequence ends, step 211 is performed; when it is determined that the encoding of the current frame sequence has not ended, step 212 is performed;
  • Step 210 Encode the next region in the current frame image
  • steps 203-208 are performed again.
  • Step 211 end the process
  • step 212 the encoding process of the next frame image is started.
  • FIG. 3 is a schematic flowchart of adjusting frame-level parameters of a current frame image in an embodiment of the present invention. As shown in Figure 3, it includes the following steps:
  • Step 301 the pre-module outputs data
  • the pre-stage module may be an ISP module of the reference frame image corresponding to the current frame image.
  • the output data of the pre-module includes data information of the video image and global motion statistics information of the video image.
  • the global motion statistics information may be motion information corresponding to all frame images in the video image.
  • Step 302 After saving the relevant data in the output data, start encoding the current frame image
  • the current frame image is divided into multiple custom-sized CTU areas according to the preset image division unit, and the global motion statistical information output by the preceding module is filtered according to the content of each CTU to obtain the The content matches the target area.
  • the motion statistical information corresponding to the target area is used to perform motion estimation on the corresponding CTU in the current frame image to obtain the motion vector parameter of the CTU.
  • the current frame image is the nth frame in the video sequence
  • the reference frame image corresponding to the current frame image is the n-1th frame in the video sequence.
  • the content matching means that the error between the content of the area A and the content of the area A'is less than the preset threshold.
  • Step 303 Determine whether the motion characteristic of the current frame image is medium motion
  • the current frame image may be first divided into multiple CTUs of equal size, and then, the motion vector parameter components corresponding to each CTU are compared with the first preset motion vector parameter and the second preset motion vector parameter, respectively, to obtain The second comparison result; then, according to the second comparison result, the CTU corresponding to the target motion vector parameter less than or equal to the first preset motion vector parameter and greater than or equal to the second preset motion vector parameter is determined as the current frame image Meet the target CTU of the coding adjustment strategy; then compare the proportion of the target CTU in the current frame image with all preset CTUs to obtain the third comparison result; when the third comparison result indicates that the motion level in the current frame is medium
  • the ratio threshold Fre_Mid
  • Step 304 the target bit number of the current frame image is unchanged.
  • Step 305 Adjust the target bit number of the current frame image.
  • the encoding parameter of the current frame image can be adjusted in at least one of the following ways: increase the number of first encoded bits corresponding to the current frame image and decrease the QP value corresponding to the current frame image.
  • Step 306 the calculation, adjustment and limiting of the QP value of the frame image
  • the limit range of the QP value of the frame image is usually 0-51. In one embodiment, the limit range of the frame image can be customized between 16-48. When the number of target bits increases, the QP value will decrease or stay the same.
  • the QP value is only fine-tuned. Therefore, after obtaining the adjusted QP value, it is also necessary to compare the adjusted QP value with the QP value before adjustment, and judge whether the adjusted QP value is within the preset adjustment amplitude according to the comparison result. When the adjusted QP value is not within the preset adjustment amplitude, the adjusted QP value needs to be adjusted to the preset adjustment amplitude.
  • the electronic device also calculates the adjusted QP value.
  • the current QP value is determined by the calculation result, it can be further adjusted.
  • the QP value of the current frame image can be in the original On the basis of minus 1, otherwise, the QP value of the current frame image is unchanged.
  • the method of calculating the QP value can refer to the above formula 1, formula 2 and formula 3).
  • the QP value of the current frame image is adjusted according to the motion level of the current frame image
  • the motion level of the current frame image is found to be moderate motion, or the motion level of a CTU in the current frame image is moderate motion, it indicates that the current frame
  • the image can also be improved through more refined processing to add a small number of codewords to significantly improve the subjective quality, then it is necessary to reduce the QP value of the current frame image calculated above.
  • the overall motion level of the current frame image belongs to smaller motion or excessive motion, it means that the subjective quality of the current frame image cannot be significantly improved by more fine-grained processing by adding a small number of codewords, then there is no need Adjust the QP value of the current frame image calculated above.
  • Step 307 encode the current frame image
  • Step 308 Determine whether the encoding of the current frame image ends
  • step 309 is performed; when it is determined that the encoding of the current frame image has not ended, step 309 is continued.
  • Step 309 Determine whether the encoding of the current frame sequence ends
  • step 310 When it is determined that the encoding of the current frame sequence ends, step 310 is performed; when it is determined that the encoding of the current frame sequence has not ended, step 311 is performed;
  • Step 310 end the process
  • step 311 the encoding process of the next frame image is started.
  • FIG. 4 is a schematic flowchart of adjusting the CTU performance parameter of the current frame image in the embodiment of the present invention. As shown in Figure 4, it includes the following steps:
  • Step 401 the pre-module outputs data
  • the pre-stage module may be an ISP module of the reference frame image corresponding to the current frame image.
  • the output data of the pre-module includes data information of the video image and global motion statistics information of the video image.
  • the global motion statistics information may be motion information corresponding to all frame images in the video image.
  • Step 402 After saving the relevant data in the output data, start encoding the current frame image
  • the current frame image is divided into multiple custom-sized CTU regions according to the preset image division unit, and the global motion statistics information output by the previous module is filtered according to the content of each CTU to obtain the The content matches the target area.
  • the motion statistical information corresponding to the target area is used to perform motion estimation on the corresponding CTU in the current frame image to obtain the motion vector parameter of the CTU.
  • the current frame image is the nth frame in the video sequence
  • the reference frame image corresponding to the current frame image is the n-1th frame in the video sequence.
  • the content matching means that the error between the content of the area A and the content of the area A'is less than the preset threshold.
  • Step 403 Determine whether the motion characteristic of each CTU in the current frame image is medium motion
  • the current frame image may be divided into multiple CTUs of equal size, and then, the motion vector parameters corresponding to at least one CTU are compared with the first preset motion vector parameter and the second preset motion vector parameter, respectively, to obtain the first A comparison result, where the first preset motion vector parameter is greater than the second preset motion vector parameter; when the first comparison result indicates that the motion vector parameter corresponding to at least one CTU in the current frame image is less than or equal to the first preset motion vector parameter , And greater than or equal to the second preset motion vector parameter, it is determined that the motion characteristic of the coding region corresponding to the current CTU in the current frame image is medium motion, then step 405 is performed; when the first comparison result represents at least one CTU in the current frame image When the corresponding motion vector parameter is greater than the first preset motion vector parameter and less than the second preset motion vector parameter, it is determined that the motion characteristic of the coding region corresponding to the current CTU in the current frame image is not moderate motion, and step 404 is executed.
  • step 404 the current CTU target bit number remains unchanged.
  • Step 405 Adjust the current CTU target bit number.
  • the encoding parameter of the current CTU may be adjusted in at least one of the following ways: increase the number of second encoded bits corresponding to the current CTU and decrease the QP value corresponding to the current CTU.
  • Step 406 Calculate, adjust, and limit the QP value of the current CTU
  • the limiting range of the current QP value of the CTU is usually 0-51. In one embodiment, the limiting range can usually be customized between 16-48. When the number of target bits increases, the QP value will decrease or stay the same.
  • the QP value is only fine-tuned. Therefore, after obtaining the adjusted QP value, it is also necessary to compare the adjusted QP value with the QP value before adjustment, and judge whether the adjusted QP value is within the preset adjustment amplitude according to the comparison result. When the adjusted QP value is not within the preset adjustment amplitude, the adjusted QP value needs to be adjusted to the preset adjustment amplitude.
  • the electronic device also calculates the adjusted QP value.
  • the current QP value can be adjusted through the calculation result, the current CTU QP value can be adjusted on the original basis. Decrease by one, otherwise, the current QP value of CTU remains unchanged.
  • the method of calculating the QP value can refer to the above formula 1, formula 2 and formula 3).
  • the QP value of the current CTU is adjusted according to the current CTU's sports level
  • the current CTU's sports level is found to be medium-level sports, or if the current CTU's sports level belongs to medium-level sports, it indicates that the current CTU can also be changed
  • Refined processing to add a small number of codewords can significantly improve the subjective quality, then it is necessary to adjust the QP value of the current CTU calculated above to be small.
  • the current overall motion level of the CTU belongs to a smaller motion or an excessive motion, it means that the subjective quality of the current CTU cannot be significantly improved by adding a small number of codewords through more elaborate processing, so there is no need to adjust the above The calculated QP value of the current CTU.
  • Step 407 encoding the current CTU
  • Step 408 Determine whether the current CTU encoding is ended
  • step 409 is performed; when it is determined that the encoding of the current CTU is not ended, step 410 is performed.
  • Step 409 Determine whether the encoding of the current frame sequence ends
  • step 411 When it is determined that the encoding of the current frame sequence ends, step 411 is performed; when it is determined that the encoding of the current frame sequence has not ended, step 412 is performed;
  • Step 410 start coding the next CTU in the current frame image
  • steps 403-408 are repeatedly performed.
  • Step 411 end the process
  • step 412 the encoding process of the next frame image is started.
  • FIG. 5 is a schematic flow chart of collaborative adjustment of the frame-level parameters and CTU-level parameters of the current frame image in the embodiment of the present invention. As shown in Figure 5, it includes the following steps:
  • Step 501 the pre-module outputs data
  • the pre-stage module may be an ISP module of the reference frame image corresponding to the current frame image.
  • the output data of the previous module includes the data information of the video image and the global motion statistics of the video image.
  • the global motion statistics information may be motion information corresponding to all frame images in the video image.
  • Step 502 After saving the relevant data in the output data, start encoding the current frame image
  • the current frame image is divided into multiple custom-sized CTU regions according to the preset image division unit, and the global motion statistics information output by the previous module is filtered according to the content of each CTU to obtain the The content matches the target area.
  • the motion statistical information corresponding to the target area is used to perform motion estimation on the corresponding CTU in the current frame image to obtain the motion vector parameter of the CTU.
  • the current frame image is the nth frame in the video sequence
  • the reference frame image corresponding to the current frame image is the n-1th frame in the video sequence.
  • the content matching means that the error between the content of the area A and the content of the area A'is less than the preset threshold.
  • Step 503 Determine whether the motion characteristic of the current frame image is medium motion
  • the current frame image may be first divided into multiple CTUs of equal size, and then, the motion vector parameter components corresponding to each CTU are compared with the first preset motion vector parameter and the second preset motion vector parameter, respectively, to obtain The second comparison result; according to the second comparison result, the CTU corresponding to the target motion vector parameter less than or equal to the first preset motion vector parameter and greater than or equal to the second preset motion vector parameter is determined to be satisfied in the current frame image
  • the target CTU of the coding adjustment strategy then compare the proportion of all CTUs in the current frame image of the target CTU with the preset ratio to obtain the third comparison result; when the third comparison result indicates that the motion level in the current frame belongs to the medium motion characteristic
  • frame threshold Frae_Mid
  • Step 504 the target bit number of the current frame image is unchanged.
  • Step 505 Adjust the target bit number of the current frame image.
  • the encoding parameter of the current frame image can be adjusted in at least one of the following ways: increase the number of first encoded bits corresponding to the current frame image and decrease the QP value corresponding to the current frame image.
  • Step 506 Calculate, adjust and limit the QP value of the current frame image
  • the limiting range of the QP value is usually 0-51. In an embodiment, the limiting range can usually be customized between 16-48. When the number of target bits increases, the QP value will decrease or stay the same.
  • the QP value is only fine-tuned. Therefore, after obtaining the adjusted QP value, it is also necessary to compare the adjusted QP value with the QP value before adjustment, and judge whether the adjusted QP value is within the preset adjustment amplitude according to the comparison result. When the adjusted QP value is not within the preset adjustment amplitude, the adjusted QP value needs to be adjusted to the preset adjustment amplitude.
  • the electronic device also calculates the adjusted QP value.
  • the current QP value is determined by the calculation result, it can be further adjusted.
  • the QP value of the current frame image can be in the original On the basis of minus 1, otherwise, the QP value of the current frame image is unchanged.
  • the method of calculating the QP value can refer to the above formula 1, formula 2 and formula 3).
  • the QP value of the current frame image is adjusted according to the motion level of the current frame image
  • the motion level of the current frame image is found to be moderate motion, or the motion level of a CTU in the current frame image is moderate motion, it indicates that the current frame
  • the image can also be improved through more refined processing to add a small number of codewords to significantly improve the subjective quality, then it is necessary to reduce the QP value of the current frame image calculated above.
  • the overall motion level of the current frame image belongs to smaller motion or excessive motion, it means that the subjective quality of the current frame image cannot be significantly improved by more fine-grained processing by adding a small number of codewords, then there is no need Adjust the QP value of the current frame image calculated above.
  • Step 507 Determine whether the motion characteristic of each CTU in the current frame image is medium motion
  • the current frame image may also be locally fine-tuned according to the motion characteristics of each CTU in the current frame image, that is, the coding region corresponding to the CTU whose motion characteristics are medium motion may be adjusted.
  • step 509 is performed; when the first comparison result represents at least one CTU in the current frame image
  • step 508 is executed.
  • step 508 the current CTU target bit number remains unchanged.
  • Step 509 Adjust the target bit number of the current CTU.
  • the encoding parameter of the current CTU may be adjusted in at least one of the following ways: increase the number of second encoded bits corresponding to the current CTU and decrease the QP value corresponding to the current CTU.
  • Step 510 the calculation, adjustment and limiting of the current CTU QP value
  • the limiting range of the current QP value of the CTU is usually 0-51. In one embodiment, the limiting range can usually be customized between 16-48. When the number of target bits increases, the QP value will decrease or stay the same.
  • the current CTU QP value is only fine-tuned. Therefore, after obtaining the adjusted QP value, it is also necessary to compare the adjusted QP value with the QP value before adjustment, and judge whether the adjusted QP value is within the preset adjustment amplitude according to the comparison result. When the adjusted QP value is not within the preset adjustment amplitude, the adjusted QP value needs to be adjusted to the preset adjustment amplitude.
  • the electronic device also calculates the adjusted QP value.
  • the current QP value can be adjusted through the calculation result, the current CTU QP value can be adjusted on the original basis. Decrease by one, otherwise, the current QP value of CTU remains unchanged.
  • the method of calculating the QP value can refer to the above formula 1, formula 2 and formula 3).
  • the QP value of the current CTU is adjusted according to the current CTU's sports level
  • the current CTU's sports level is found to be medium-level sports, or if the current CTU's sports level belongs to medium-level sports, it indicates that the current CTU can also be changed
  • Refined processing to add a small number of codewords can significantly improve the subjective quality, then it is necessary to adjust the QP value of the current CTU calculated above to be small.
  • the current overall motion level of the CTU belongs to a smaller motion or an excessive motion, it means that the subjective quality of the current CTU cannot be significantly improved by adding a small number of codewords through more elaborate processing, so there is no need to adjust the above The calculated QP value of the current CTU.
  • Step 511 and encode the current CTU
  • Step 512 Determine whether the current CTU encoding is ended
  • step 513 is performed; when it is determined that the encoding of the current CTU is not ended, step 514 is performed.
  • Step 513 Determine whether the encoding of the current frame sequence ends
  • step 515 When it is determined that the encoding of the current frame sequence ends, step 515 is performed; when it is determined that the encoding of the current frame sequence has not ended, step 516 is performed;
  • Step 514 start coding the next CTU in the current frame image
  • steps 507-512 are repeatedly performed.
  • Step 515 end the process
  • step 516 the encoding process of the next frame image is started.
  • FIG. 6 is a first schematic diagram of the structural composition of a data processing device in an embodiment of the present invention. As shown in FIG. 6, the device includes:
  • the obtaining unit 601 is configured to obtain the motion vector parameters of the current frame image corresponding to the reference frame image according to the output result of the reference frame image;
  • the determining unit 602 is set to determine the motion level corresponding to the target area in the current frame image according to the motion vector parameter;
  • the adjusting unit 603 is configured to adjust the encoding parameters of the current frame image when the motion level meets the encoding adjustment strategy.
  • the device may be a device with video encoding processing capabilities, and the device further includes:
  • the dividing unit 604 is configured to divide the current frame image into multiple CTUs according to a preset image division unit, and the size of each CTU is the same.
  • the determining unit 602 is further configured to determine at least one CTU of the plurality of CTUs as the target area, or determine the entire coding area corresponding to the current frame image as the target area.
  • the device further includes a comparison unit 605 configured to compare the motion vector parameters corresponding to the at least one CTU with the first preset motion vector parameter and the second preset motion vector parameter, respectively, to obtain A first comparison result, the first preset motion vector parameter is greater than the second preset motion vector parameter; or, the motion vector parameter components corresponding to each CTU of the plurality of CTUs are respectively compared with the first Comparing a preset motion vector parameter with the second preset motion vector parameter to obtain a second comparison result; and comparing the ratio of all CTUs of the target CTU in the current frame image to the preset ratio To get the third comparison result.
  • a comparison unit 605 configured to compare the motion vector parameters corresponding to the at least one CTU with the first preset motion vector parameter and the second preset motion vector parameter, respectively, to obtain A first comparison result, the first preset motion vector parameter is greater than the second preset motion vector parameter; or, the motion vector parameter components corresponding to each CTU of the plurality of CTUs are respectively compared with the first Comparing
  • the motion level satisfies the coding adjustment strategy, including at least one of the following conditions:
  • the first comparison result corresponding to the motion level characterizes that the motion vector parameter component corresponding to the at least one CTU is less than or equal to the motion vector parameter component and greater than or equal to the second motion vector parameter;
  • the third comparison result corresponding to the motion level indicates that the ratio of all CTUs of the target CTU in the current frame image is greater than the preset ratio; and the time when the motion level does not meet the coding adjustment strategy is reached Preset time.
  • the adjusting unit 603 is set to adjust the encoding parameter of the current frame image by at least one of the following ways: increasing the number of first encoding bits corresponding to the current frame image, and decreasing the current QP value of the quantization parameter corresponding to the frame image, increasing the number of second encoded bits corresponding to the target CTU in the current frame image, and decreasing the QP value corresponding to the target CTU.
  • the adjustment unit 603 when reducing the QP value of the quantization parameter corresponding to the current frame image, is further set according to the number of target encoding bits allocated to the current frame image and the current frame image.
  • the number of CTUs increases the number of second encoded bits corresponding to each CTU among the multiple CTUs of the current frame image; according to the number of second encoded bits, decreases the number of second encoded bits corresponding to the current frame image QP value.
  • the data processing device provided in the above embodiment is only exemplified by the division of each program module. In practical applications, the above processing can be allocated as needed Different program modules are completed, that is, the internal structure of the data processing device is divided into different program modules to complete all or part of the processing described above.
  • the data processing apparatus provided in the foregoing embodiment and the foregoing data processing method embodiment belong to the same concept, and the implementation process thereof is described in detail in the method embodiment, and will not be repeated here.
  • FIG. 7 is a second schematic diagram of the structure of the data processing device in the embodiment of the present invention.
  • the data processing device 700 may be a mobile phone, a computer, a digital broadcasting terminal, an information transceiving device, a game console, a tablet device, or an individual. Digital assistant, information push server, content server, etc.
  • the data processing apparatus 700 shown in FIG. 7 includes: at least one processor 701, a memory 702, at least one network interface 704, and a user interface 703. Each component in the data processing apparatus 700 is coupled together through a bus system 705. It can be understood that the bus system 705 is used to implement connection and communication between these components.
  • the bus system 705 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, each type of bus is marked as the bus system 705 in FIG. 7.
  • the user interface 703 may include a display, a keyboard, a mouse, a trackball, a click wheel, buttons, buttons, a touch panel, or a touch screen.
  • the memory 702 may be a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memory.
  • the non-volatile memory can be read-only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory , EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Ferromagnetic Random Access Memory (FRAM), Flash Memory (Flash Memory), Magnetic Surface Memory , Compact disc, or read-only compact disc (Compact Disc Read-Only Memory, CD-ROM); the magnetic surface memory can be a disk storage or a tape storage.
  • the volatile memory may be a random access memory (Random Access Memory, RAM), which is used as an external cache.
  • RAM Random Access Memory
  • SRAM Static Random Access Memory
  • SRAM Synchronous Static Random Access Memory
  • SSRAM Synchronous Static Random Access Memory
  • DRAM Dynamic Random Access Memory
  • DRAM Synchronous Dynamic Random Access Memory
  • SDRAM Double Data Rate Synchronous Dynamic Random Access Memory
  • DDRSDRAM Double Data Rate Synchronous Dynamic Random Access Memory
  • ESDRAM synchronous link dynamic random access memory
  • SyncLink Dynamic Random Access Memory, SLDRAM direct memory bus random access memory
  • Direct Rambus Random Access Memory, DRRAM Direct Rambus Random Access Memory
  • the memory 702 described in this embodiment of the present invention is intended to include, but is not limited to, these and any other suitable types of memory.
  • the memory 702 in the embodiment of the present invention is configured to store various types of data to support the operation of the data processing apparatus 700.
  • Examples of these data include: any computer program for operating on the data processing device 700, such as an operating system 7021 and an application program 7022; music data; animation data; book information; video, etc.
  • the operating system 7021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks.
  • the application program 7022 may include various application programs, such as a media player (Media Player), a browser (Browser), etc., for implementing various application services.
  • the program for implementing the method of the embodiment of the present invention may be included in the application program 7022.
  • the method disclosed in the foregoing embodiment of the present invention may be applied to the processor 701, or implemented by the processor 701.
  • the processor 701 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware in the processor 701 or instructions in the form of software.
  • the foregoing processor 701 may be a general-purpose processor, a digital signal processor (DSP, Digital Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and the like.
  • the processor 701 may implement or execute the disclosed methods, steps, and logical block diagrams in the embodiments of the present invention.
  • the general-purpose processor may be a microprocessor or any conventional processor.
  • the steps of the method disclosed in the embodiments of the present invention may be directly implemented and completed by a hardware decoding processor, or may be implemented and completed by a combination of hardware and software modules in the decoding processor.
  • the software module may be located in a storage medium.
  • the storage medium is located in the memory 702.
  • the processor 701 reads the information in the memory 702 and completes the steps of the foregoing method in combination with its hardware.
  • the data processing apparatus 700 may be composed of one or more application specific integrated circuits (Application Specific Integrated Circuit (ASIC), DSP, programmable logic device (Programmable Logic Device, PLD), complex programmable logic device ( Complex Programmable Logic Device (CPLD), Field-Programmable Gate Array (FPGA), general-purpose processor, controller, microcontroller (Micro Controller), microprocessor (Microprocessor), or other Electronic components are implemented to perform the aforementioned method.
  • ASIC Application Specific Integrated Circuit
  • DSP digital signal processor
  • PLD programmable logic device
  • CPLD Complex Programmable Logic Device
  • FPGA Field-Programmable Gate Array
  • controller microcontroller
  • Microcontroller Micro Controller
  • Microprocessor Microprocessor
  • the processor 701 runs the computer program, it executes: acquiring the motion vector parameters of the current frame image corresponding to the reference frame image according to the output result of the reference frame image; determining the current according to the motion vector parameters The motion level corresponding to the target area in the frame image; when the motion level meets the coding adjustment strategy, adjust the coding parameters of the current frame image.
  • the processor 701 runs the computer program, it also executes: dividing the current frame image into a plurality of coding tree unit CTUs according to a preset image division unit; dividing the coding region corresponding to at least one CTU among the plurality of CTUs It is determined to be the target area, or the entire coding area corresponding to the current frame image is determined to be the target area.
  • the processor 701 runs the computer program, it also executes: when the target area is an encoding area corresponding to at least one CTU of the plurality of CTUs, the motion vector parameter includes motion corresponding to the at least one CTU Vector parameter component, comparing the motion vector parameter component corresponding to the at least one CTU with a first preset motion vector parameter and a second preset motion vector parameter respectively to obtain a first comparison result, the first preset The motion vector parameter is greater than the second preset motion vector parameter; according to the first comparison result, the motion level corresponding to the at least one CTU is determined; when the target area is the overall coding area corresponding to the current frame image , The motion vector parameter includes a motion vector parameter component corresponding to each CTU among multiple CTUs of the current frame image, and the motion vector parameter component corresponding to each CTU among the multiple CTUs is A preset motion vector parameter is compared with the second preset motion vector parameter to obtain a second comparison result; according to the second comparison result, the first preset motion vector parameter is less than or equal
  • the exercise level satisfies the coding adjustment strategy, including at least one of the following conditions:
  • the first comparison result corresponding to the motion level characterizes that the motion vector parameter component corresponding to the at least one CTU is less than or equal to the motion vector parameter component and greater than or equal to the second motion vector parameter;
  • the third comparison result corresponding to the motion level indicates that the ratio of all CTUs of the target CTU in the current frame image is greater than the preset ratio; and the time when the motion level does not meet the coding adjustment strategy is reached Preset time.
  • the processor 701 runs the computer program, it also executes at least one of the following: increasing the number of first encoded bits corresponding to the current frame image, decreasing the quantization parameter QP value corresponding to the current frame image, increasing The number of second encoded bits corresponding to the target CTU in the current frame image, and reducing the QP value corresponding to the target CTU.
  • the processor 701 runs the computer program, it also executes: according to the number of target encoding bits allocated to the current frame image and the number of CTUs in the current frame image, increase the number of the current frame image The second coded bit number corresponding to each CTU in the CTU; according to the second coded bit number, the QP value corresponding to the current frame image is reduced.
  • an embodiment of the present invention further provides a computer-readable storage medium, for example, a memory 702 including a computer program, which can be executed by the processor 701 of the data processing apparatus 700 to complete the foregoing method step.
  • the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disk, or CD-ROM; it may also be various devices including one or any combination of the above memories, such as Mobile phones, computers, tablet devices, personal digital assistants, etc.
  • the computer program When the computer program is executed by the processor, it also executes: dividing the current frame image into a plurality of coding tree unit CTUs according to a preset image division unit; determining the coding region corresponding to at least one CTU among the plurality of CTUs as the The target area, or the entire coding area corresponding to the current frame image is determined as the target area.
  • the motion vector parameter when the target area is an encoding area corresponding to at least one CTU of the plurality of CTUs, the motion vector parameter includes a motion vector parameter component corresponding to the at least one CTU , Comparing the motion vector parameter components corresponding to the at least one CTU with the first preset motion vector parameter and the second preset motion vector parameter respectively to obtain a first comparison result, the first preset motion vector parameter Greater than the second preset motion vector parameter; determining the motion level corresponding to the at least one CTU according to the first comparison result; when the target area is the overall coding area corresponding to the current frame image, the The motion vector parameter includes a motion vector parameter component corresponding to each CTU of the plurality of CTUs of the current frame image, and the motion vector parameter component corresponding to each CTU of the plurality of CTUs is respectively compared with the first preset The motion vector parameter is compared with the second preset motion vector parameter to obtain a second comparison result; according to the second comparison result, the first prese
  • the exercise level satisfies the coding adjustment strategy, including at least one of the following conditions:
  • the first comparison result corresponding to the motion level characterizes that the motion vector parameter component corresponding to the at least one CTU is less than or equal to the motion vector parameter component and greater than or equal to the second motion vector parameter;
  • the third comparison result corresponding to the motion level indicates that the ratio of all CTUs of the target CTU in the current frame image is greater than the preset ratio; and the time when the motion level does not meet the coding adjustment strategy is reached Preset time.
  • the computer program When the computer program is executed by the processor, it also executes at least one of the following: increasing the number of first encoded bits corresponding to the current frame image, decreasing the quantization parameter QP value corresponding to the current frame image, and increasing the current The number of second encoded bits corresponding to the target CTU in the frame image, and reducing the QP value corresponding to the target CTU.
  • the computer program When the computer program is run by the processor, it also executes: increasing each of the multiple CTUs of the current frame image according to the number of target coded bits allocated for the current frame image and the number of CTUs in the current frame image The number of second encoded bits corresponding to each CTU; according to the number of second encoded bits, decrease the QP value corresponding to the current frame image.

Landscapes

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

Abstract

Provided are a data processing method and apparatus, and a storage medium. The method comprises: acquiring, according to an output result of a reference frame image, a motion vector parameter of a current frame image corresponding to the reference frame image; determining, according to the motion vector parameter, a motion level corresponding to a target area in the current frame image; and when the motion level satisfies a coding adjustment policy, adjusting a coding parameter of the current frame image.

Description

数据处理方法、装置及存储介质Data processing method, device and storage medium
本申请要求在2018年12月17日提交中国专利局、申请号为201811541533.5的中国专利申请的优先权,以上申请的全部内容通过引用结合在本申请中。This application requires the priority of the Chinese patent application with the application number 201811541533.5 submitted to the China Patent Office on December 17, 2018. The entire contents of the above applications are incorporated by reference in this application.
技术领域Technical field
本公开涉及数据处理技术,例如涉及一种数据处理的方法、装置及存储介质。The present disclosure relates to data processing technology, for example, to a data processing method, device, and storage medium.
背景技术Background technique
随着视频行业快速发展,视频分辨率和视频码流也不断扩大。视频码流作为视频编码中控制画面质量的最重要的部分,同样的视频分辨率下,视频码流越大,视频压缩比就越小,画面质量就越高,需要的网络带宽就越大,这势必会给网络带宽带来极大的压力。因此,在不增加网络带宽的情况下,如何通过调整视频码流来提高视频文件的编码质量变得很重要。但是,相关技术通过编码控制算法只能对于具有静止和小运动场景的视频码流的编码质量进行提高,无法提高具有中等运动特性的视频码流的编码质量。With the rapid development of the video industry, the video resolution and video bitstream are also expanding. As the most important part to control the picture quality in video coding, the video stream is the same. At the same video resolution, the larger the video stream, the smaller the video compression ratio, the higher the picture quality, and the greater the network bandwidth required. This is bound to bring great pressure on the network bandwidth. Therefore, without increasing the network bandwidth, how to improve the encoding quality of video files by adjusting the video stream becomes very important. However, the related art can only improve the coding quality of video streams with still and small motion scenes through coding control algorithms, but cannot improve the coding quality of video streams with medium motion characteristics.
发明内容Summary of the invention
本发明实施例期望提供一种数据处理方法、装置及存储介质,能够提高视频码流的编码质量。Embodiments of the present invention are expected to provide a data processing method, device, and storage medium, which can improve the encoding quality of a video bitstream.
本发明实施例提供一种数据处理方法,所述方法包括:An embodiment of the present invention provides a data processing method. The method includes:
根据参考帧图像的输出结果,获取与所述参考帧图像对应的当前帧图像的运动矢量参数;Acquiring the motion vector parameters of the current frame image corresponding to the reference frame image according to the output result of the reference frame image;
根据所述运动矢量参数,确定所述当前帧图像中目标区域对应的运动级别;Determine the motion level corresponding to the target area in the current frame image according to the motion vector parameter;
当所述运动级别满足编码调整策略时,调整所述当前帧图像的编码参数。When the motion level satisfies the coding adjustment strategy, the coding parameters of the current frame image are adjusted.
本发明实施例提供一种数据处理装置,所述装置包括:An embodiment of the present invention provides a data processing device. The device includes:
获取单元,设置为根据参考帧图像的输出结果,获取与所述参考帧图像对应的当前帧图像的运动矢量参数;An obtaining unit configured to obtain the motion vector parameters of the current frame image corresponding to the reference frame image according to the output result of the reference frame image;
确定单元,设置为根据所述运动矢量参数,确定所述当前帧图像中目标区域对应的运动级别;A determining unit, configured to determine the motion level corresponding to the target area in the current frame image according to the motion vector parameter;
调整单元,设置为当所述运动级别满足编码调整策略时,调整所述当前帧图像的编码参数。The adjusting unit is configured to adjust the encoding parameters of the current frame image when the motion level meets the encoding adjustment strategy.
本发明实施例提供一种数据处理装置,所述装置包括:存储器和处理器;An embodiment of the present invention provides a data processing apparatus. The apparatus includes: a memory and a processor;
其中,所述存储器,设置为存储能够在所述处理器上运行的计算机程序;Wherein, the memory is configured to store a computer program that can run on the processor;
所述处理器,设置为运行所述计算机程序时,执行上述数据处理方法的步骤。The processor is configured to execute the steps of the above data processing method when running the computer program.
本发明实施例还提供一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行上述数据处理方法的步骤。An embodiment of the present invention also provides a computer-readable storage medium that stores computer-executable instructions, and the computer-executable instructions are used to perform the steps of the foregoing data processing method.
本发明实施例提供了一种数据处理方法、装置及存储介质,通过从参考帧图像的输出结果中,获取当前帧图像的运动矢量信息,能够降低硬件的实现复杂度;而根据当前帧图像的运动矢量参数确定当前帧图像中目标区域对应的运动级别满足编码调整策略时,对当前帧图像的编码参数进行调整,能够在带宽增加很少的情况下,显著提高当前帧图像的编码质量。Embodiments of the present invention provide a data processing method, device, and storage medium. By acquiring the motion vector information of the current frame image from the output result of the reference frame image, the implementation complexity of the hardware can be reduced; When the motion vector parameter determines that the motion level corresponding to the target area in the current frame image meets the coding adjustment strategy, adjusting the coding parameters of the current frame image can significantly improve the coding quality of the current frame image with little bandwidth increase.
附图说明BRIEF DESCRIPTION
图1为本发明实施例中数据处理方法的流程示意图;FIG. 1 is a schematic flowchart of a data processing method in an embodiment of the present invention;
图2为本发明实施例中数据处理方法的整体流程示意图;2 is a schematic diagram of the overall process of the data processing method in the embodiment of the present invention;
图3是本发明实施例中针对当前帧图像的帧级参数进行调整的流程示意图;3 is a schematic flowchart of adjusting frame-level parameters of an image of a current frame in an embodiment of the present invention;
图4是本发明实施例中针对当前帧图像的CTU(Coding Tree Unit,编码树单元)级参数进行调整的流程示意图;4 is a schematic flowchart of adjusting CTU (Coding Tree Unit) level parameters of a current frame image in an embodiment of the present invention;
图5是本发明实施例中针对当前帧图像的帧级参数和CTU级参数协同调整的流程示意图;FIG. 5 is a schematic flow chart of collaborative adjustment of the frame-level parameters and CTU-level parameters of the current frame image in the embodiment of the present invention;
图6为本发明实施例中数据处理装置的结构组成示意一;FIG. 6 is a first schematic diagram of the structural composition of a data processing device in an embodiment of the present invention;
图7为本发明实施例中数据处理装置的结构组成示意二。FIG. 7 is a second schematic diagram of the structural composition of the data processing device in the embodiment of the present invention.
具体实施方式detailed description
下面结合附图对本公开的具体实施方式进行详细说明。应当理解的是,此处所描述的具体实施方式仅用于说明和解释本公开,并不用于限制本公开。The specific embodiments of the present disclosure will be described in detail below with reference to the drawings. It should be understood that the specific embodiments described herein are only used to illustrate and explain the present disclosure, and are not intended to limit the present disclosure.
图1为本发明实施例中数据处理方法的流程示意图,如图1所示,所述方法包括:FIG. 1 is a schematic flowchart of a data processing method in an embodiment of the present invention. As shown in FIG. 1, the method includes:
步骤101,根据参考帧图像的输出结果,获取与所述参考帧图像对应的当前帧图像的运动矢量参数;Step 101: Obtain the motion vector parameters of the current frame image corresponding to the reference frame image according to the output result of the reference frame image;
本发明实施例中,该方法主要应于具有视频图像编码功能的电子设备,该电子设备在处理当前帧图像的图像信号时,通常会先按照预设图像分割单位将当前帧图像划分为多个编码树单元(Coding Tree Unit,CTU),每个CTU的大小可以是64x64。然后,将至少一个CTU对应的编码区域作为当前帧图像中的区域A,并根据区域A的内容在当前帧图像对应的参考帧图像中搜索与区域A的内容相匹配的区域A',并将区域A'所在位置确定为区域A在参考帧图像中的最佳匹配位置,将区域A'对应的运动统计信息作为参考帧图像的输出结果。In the embodiment of the present invention, the method is mainly applicable to an electronic device with a video image encoding function. When processing the image signal of the current frame image, the electronic device usually divides the current frame image into multiples according to a preset image division unit Coding Tree Unit (CTU), the size of each CTU can be 64x64. Then, use the coding region corresponding to at least one CTU as the region A in the current frame image, and search for the region A′ that matches the content of the region A in the reference frame image corresponding to the current frame image according to the content of the region A, and The location of the area A'is determined as the best matching position of the area A in the reference frame image, and the motion statistical information corresponding to the area A'is used as the output result of the reference frame image.
这里,运动统计信息可以是区域A与区域A'在水平和垂直方向上的偏移量。其中,区域A与区域A'相匹配是指区域A与区域A'之间的误差最小,该误差可以是区域A与区域A'之间的误差平方和(Sum of Squared Error,SSE)、绝对误差和(Sum of Absolute Difference,SAD)或者绝对变换差和(Sum of Absolute Transformed Difference,SATD)等。Here, the motion statistical information may be the offset of the area A and the area A′ in the horizontal and vertical directions. Among them, the matching of the area A and the area A′ means that the error between the area A and the area A′ is the smallest, and the error may be the sum of squared errors (Sum of Squared Error, SSE), absolute Sum of errors (Sum of Absolute Difference, SAD) or sum of absolute transformation differences (Sum of Absolute Transformed Difference, SATD), etc.
当电子设备获取到参考帧图像的输出结果后,会利用该输出结果对当前帧图像的区域A进行运动估计(Vector Estimator,VE),以得到区域A的运动矢量参数。After the electronic device obtains the output result of the reference frame image, it uses the output result to perform motion estimation (Vector Estimator, VE) on the area A of the current frame image to obtain the motion vector parameter of the area A.
这里,运动矢量参数包括区域A在水平方向上运动估计值的偏移量和在垂直方向上运动估计值的偏移量。并且,区域A在水平方向上运动估计值的偏移量和在垂直方向上运动估计值的偏移量的数值不是以像素大小为单位,而是以图像信号处理模块(Image Signal Processing,ISP)内部设置的大小为单位。Here, the motion vector parameters include the offset of the motion estimation value of the area A in the horizontal direction and the offset of the motion estimation value in the vertical direction. In addition, the numerical values of the offset of the motion estimation value in the horizontal direction and the offset of the motion estimation value in the vertical direction of the area A are not in the unit of pixel size, but in the image signal processing module (Image) Processing (ISP) The internally set size is in units.
其中,区域A在水平方向上运动估计值的偏移量可以表示为:offset_x,区域A在垂直方向上的VE值可以表示为:offset_y。The offset of the motion estimation value of the area A in the horizontal direction can be expressed as offset_x, and the VE value of the area A in the vertical direction can be expressed as: offset_y.
本发明实施例中,还可以将当前帧图像对应的整体编码区域作为区域A。In the embodiment of the present invention, the entire coding region corresponding to the current frame image may also be used as the region A.
当电子设备将整体编码区域作为区域A时,该区域A可以包括多个CTU,每个CTU的大小相等,区域A的运动矢量参数中则可以包括有多个CTU对应的运动矢量参数分量。When the electronic device regards the entire coding region as the region A, the region A may include multiple CTUs, and the size of each CTU is equal. The motion vector parameter of the region A may include motion vector parameter components corresponding to multiple CTUs.
步骤102,根据所述运动矢量参数,确定所述当前帧图像中目标区域对应的运动级别;Step 102: Determine the motion level corresponding to the target area in the current frame image according to the motion vector parameter;
本发明实施例中,可以将当前帧图像的多个CTU中至少一个CTU对应的编码区域确定为目标区域,也可以将当前帧图像对应的整体编码区域确定为目标区域。In the embodiment of the present invention, the coding region corresponding to at least one CTU among the multiple CTUs of the current frame image may be determined as the target region, or the entire coding region corresponding to the current frame image may be determined as the target region.
这里,当电子设备将当前帧图像中至少一个CTU对应的编码区域确定为目标区域时,运动矢量参数包括至少一个CTU对应的运动矢量参数分量,可以将至少一个CTU对应的运动矢量参数分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第一比较结果,其中,第一预设运动矢量参数大于第二预设运动矢量参数;然后,根据第一比较结果,确定至少一个CTU对应的运动级别。其中,第一预设运动矢量参数和第二预设运动矢量参数值是编码前自定义的值,一般是依据使用的场景类型和经验值所设定,或者训练得到。Here, when the electronic device determines the coding region corresponding to at least one CTU in the current frame image as the target region, the motion vector parameter includes the motion vector parameter component corresponding to at least one CTU, and the motion vector parameter corresponding to the at least one CTU may be A preset motion vector parameter is compared with a second preset motion vector parameter to obtain a first comparison result, where the first preset motion vector parameter is greater than the second preset motion vector parameter; then, based on the first comparison result, it is determined At least one CTU corresponds to the exercise level. Among them, the first preset motion vector parameter and the second preset motion vector parameter value are values customized before encoding, and are generally set according to the scene type and experience value used, or obtained by training.
例如,根据第一比较结果,确定至少一个CTU对应的运动矢量参数小于第二预设运动矢量参数时,则确定至少一个CTU对应的运动级别是较小运动;如果,根据第一比较结果,确定至少一个CTU对应的运动矢量参数大于第一预设运动矢量参数时,则确定至少一个CTU对应的运动级别是过大运动;如果,根据第一比较结果,确定至少一个CTU对应的运动矢量参数小于或等于第一预设运动矢量参数,且大于或等于第二预设运动矢量参数时,则确定至少一个CTU对应的运动级别是中等运动。如此,可以通过判断当前帧图像的某个CTU对应的运动级别,来对当前帧图像中某个CTU的编码参数进行微调。For example, according to the first comparison result, when it is determined that the motion vector parameter corresponding to at least one CTU is less than the second preset motion vector parameter, it is determined that the motion level corresponding to the at least one CTU is a smaller motion; if, according to the first comparison result, it is determined When the motion vector parameter corresponding to at least one CTU is greater than the first preset motion vector parameter, it is determined that the motion level corresponding to the at least one CTU is excessive motion; if, according to the first comparison result, it is determined that the motion vector parameter corresponding to the at least one CTU is less than Or equal to the first preset motion vector parameter and greater than or equal to the second preset motion vector parameter, it is determined that the motion level corresponding to at least one CTU is medium motion. In this way, the coding parameters of a certain CTU in the current frame image can be fine-tuned by determining the motion level corresponding to a certain CTU of the current frame image.
这里,当电子设备将当前帧图像对应的整体编码区域确定为目标区域时,运动矢量参数包括当前帧图像的多个CTU中每个CTU对应的运动矢量参数分量,可以将多个CTU中每个CTU对应的运动矢量参数分量分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第二比较结果;然后,根据第二比较结果,将小于或等于第一预设运动矢量参数、且大于或等于第二预设运动矢量参数的目标运动矢量参数对应的CTU,确定为当前帧图像中满足编码调整策略的目标CTU;再将目标CTU在当前帧图像中所有CTU的占比与预设占比进行比较,得到第三比较结果;并根据第三比较结果,确定当前帧图像 中目标区域对应的运动级别。Here, when the electronic device determines the entire coding region corresponding to the current frame image as the target region, the motion vector parameter includes the motion vector parameter component corresponding to each CTU among the multiple CTUs of the current frame image, and each of the multiple CTUs The motion vector parameter components corresponding to the CTU are compared with the first preset motion vector parameter and the second preset motion vector parameter respectively to obtain a second comparison result; then, according to the second comparison result, the first preset motion will be less than or equal to The vector parameter and the CTU corresponding to the target motion vector parameter greater than or equal to the second preset motion vector parameter is determined to be the target CTU in the current frame image that meets the coding adjustment strategy; then the target CTU is accounted for by all CTUs in the current frame image The ratio is compared with the preset ratio to obtain a third comparison result; and according to the third comparison result, the motion level corresponding to the target area in the current frame image is determined.
例如,当第三比较结果表征,中等运动特性的CTU总数在当前帧图像中所有CTU总数的占比大于预设的中等运动特性的占比阈值时,认为当前帧图像的运动级别是中等运动;如果,当第三比较结果表征,过大运动特性的CTU总数在当前帧图像中所有CTU总数的占比大于预设的过大运动特性的占比阈值时,认为当前帧图像的运动级别是过大运动;当第三比较结果表征,较小运动特性的CTU总数在当前帧图像中所有CTU总数的占比大于预设的较小运动特性的占比阈值时,认为当前帧图像的运动级别是较小运动。如此,可以通过判断当前帧图像的运动级别,来对当前帧图像的编码参数进行微调。For example, when the third comparison result indicates that the proportion of the total number of CTUs with medium motion characteristics in the total number of all CTUs in the current frame image is greater than the preset threshold for the proportion of medium motion characteristics, the motion level of the current frame image is considered to be medium motion; If the third comparison result indicates that the proportion of the total number of CTUs with excessive motion characteristics in the current frame image is greater than the preset threshold for the proportion of excessive motion characteristics, the motion level of the current frame image is considered to be excessive. Large motion; when the third comparison result indicates that the proportion of the total number of CTUs with smaller motion characteristics in the current frame image is greater than the preset threshold for the proportion of smaller motion characteristics, the motion level of the current frame image is considered to be Less movement. In this way, the encoding parameters of the current frame image can be fine-tuned by determining the motion level of the current frame image.
步骤103,当所述运动级别满足编码调整策略时,调整所述当前帧图像的编码参数。Step 103: When the motion level meets the coding adjustment strategy, adjust the coding parameters of the current frame image.
本发明实施例中,所述编码调整策略可以是:所述运动级别是较高运动特性或较小运动特性时,不对当前帧图像的编码参数进行调节;所述运动级别是中等运动特性时,对当前帧图像编码参数进行调节。In the embodiment of the present invention, the coding adjustment strategy may be: when the motion level is a higher motion characteristic or a smaller motion characteristic, the coding parameters of the current frame image are not adjusted; when the motion level is a medium motion characteristic, Adjust the image encoding parameters of the current frame.
例如,可以在运动级别对应的第一比较结果表征当前帧图像中至少一个CTU对应的运动矢量参数分量小于或等于第一预设运动矢量参数、且大于或等于第二预设运动矢量参数时,确定该运动级别满足编码调整策略。此时,可以通过以下方式至少之一实现对当前帧图像的编码参数进行调整:增大当前帧图像中目标CTU对应的第二编码比特数和减小目标CTU对应的QP(Quantization Parameter,量化参数)值。For example, when the first comparison result corresponding to the motion level represents that the motion vector parameter component corresponding to at least one CTU in the current frame image is less than or equal to the first preset motion vector parameter and greater than or equal to the second preset motion vector parameter, It is determined that the exercise level satisfies the coding adjustment strategy. At this time, the encoding parameters of the current frame image can be adjusted in at least one of the following ways: increase the number of second encoding bits corresponding to the target CTU in the current frame image and decrease the QP (Quantization Parameters) corresponding to the target CTU, quantization parameter )value.
例如,当前帧图像中当前CTU的运动矢量参数分量是:Motion_cur,根据当前帧图像的帧类型、像素分布区域、图像场景等条件,设置两个表示当前CTU的运动矢量大小的第一预设运动矢量参数:Motion_Thred_High和第二预设运动 矢量参数:Motion_Thred_Low。其中,第一预设运动矢量参数和第二预设运动矢量参数分别记录的是运动矢量标量化的值。这里默认Motion_Thred_High=2500,Motion_Thred_Low=200,然后,将当前CTU的运动矢量参数(Motion_cur)分别与第一预设运动矢量参数(Motion_Thred_High)和第二预设运动矢量参数(Motion_Thred_Low)进行比较得到第一比较结果。当第一比较结果表征:Motion_cur<Motion_Thred_Low,则认为当前CTU的运动级别属于较小运动,当前帧图像的当前CTU的编码参数不需要调整,依然按照常规编码参数进行编码即可。这是因为对于较小运动特性的帧图像,常规的编码控制算法已经可以做的比较好了,所以不需要再对较小运动特性的视频码流进行再次编码调整。如果第一比较结果表征:Motion_cur>Motion_Thred_High,则认为当前CTU运动级别属于过大运动,也不需要对当前帧图像的当前CTU的级编码参数进行调整,也依然按照常规编码参数进行编码即可。这是因为对于运动过大的运动特性的帧图像,由于图像传感器中电荷耦合元件(Charge-coupled Device,CCD)或者互补金属氧化物半导体(Complementary Metal Oxide Semiconductor,CMOS)芯片的原因,无法从对应的参考帧图像中得到精确的运动矢量参数,因此去提升失真图像的编码质量,意义不大。如果第一比较结果表征:Motion_Thred_Low<=Motion_cur<=Motion_Thred_High,则认为当前CTU的运动级别属于中等运动,此时,电子设备中的图像传感器可以从当前帧图像对应的参考帧图像中得到比较准确的运动矢量参数,因此,可以对当前帧图像的当前CTU的编码参数进行调整。For example, the motion vector parameter component of the current CTU in the current frame image is: Motion_cur, according to the frame type, pixel distribution area, image scene and other conditions of the current frame image, two first preset motions indicating the size of the current CTU motion vector are set Vector parameter: Motion_Thred_High and the second preset motion vector parameter: Motion_Thred_Low. Wherein, the first preset motion vector parameter and the second preset motion vector parameter respectively record the quantized value of the motion vector. Here, the default Motion_Thred_High=2500 and Motion_Thred_Low=200, and then compare the current CTU motion vector parameter (Motion_cur) with the first preset motion vector parameter (Motion_Thred_High) and the second preset motion vector parameter (Motion_Thred_Low) to get the first Comparing results. When the first comparison result characterizes: Motion_cur<Motion_Thred_Low, it is considered that the current CTU motion level belongs to a smaller motion, and the current CTU encoding parameters of the current frame image do not need to be adjusted, and still can be encoded according to the conventional encoding parameters. This is because for frame images with smaller motion characteristics, the conventional coding control algorithm can already do better, so there is no need to re-encode and adjust video streams with smaller motion characteristics. If the first comparison result signifies: Motion_cur>Motion_Thred_High, it is considered that the current CTU motion level belongs to excessive motion, and there is no need to adjust the current CTU level coding parameters of the current frame image, and it can still be coded according to conventional coding parameters. This is because for frame images with excessive motion characteristics, due to the charge-coupled device (CCD) or complementary metal oxide semiconductor (Complementary Metal Oxide Semiconductor (CMOS)) chip in the image sensor, the corresponding The accurate motion vector parameters are obtained in the reference frame image of, so it is of little significance to improve the encoding quality of the distorted image. If the first comparison result characterizes: Motion_Thred_Low<=Motion_cur<=Motion_Thred_High, it is considered that the current motion level of the CTU belongs to medium motion. At this time, the image sensor in the electronic device can obtain a more accurate result from the reference frame image corresponding to the current frame image Motion vector parameters, therefore, the coding parameters of the current CTU of the current frame image can be adjusted.
本发明实施例中,还可以在运动级别对应的第三比较结果表征目标CTU在当前帧图像中所有CTU的占比大于所述预设占比时,确定该运动级别满足编码调整策略。此时,可以通过以下方式至少之一实现对当前帧图像的编码参数进 行调整:增大当前帧图像对应的第一编码比特数和减小当前帧图像对应的QP值。In the embodiment of the present invention, when the third comparison result corresponding to the motion level indicates that the ratio of all CTUs in the current frame image of the target CTU is greater than the preset ratio, it may be determined that the motion level meets the coding adjustment strategy. At this time, the encoding parameters of the current frame image can be adjusted in at least one of the following ways: increase the number of first encoded bits corresponding to the current frame image and decrease the QP value corresponding to the current frame image.
例如,根据当前帧图像的帧类型、像素分布区域、图像场景等条件设置三个表示当前帧图像中每种运动特性的CTU在所有CTU中的占比阈值:Frame_High、Frame_Mid和Frame_Low,该三个占比阈值分别记录的是运动级别为“过大运动、中等运动、较小运动”的CTU分别在当前帧图像中所有CTU中所占的百分比,该百分比的记录范围可以是0~1。该三个占比阈值可以根据当前帧图像的帧类型、分布区域、场景等条件设置不同值,这里默认Frame_High=0.5,Frame_Mid=0.5,Frame_Low=0.5。For example, according to the frame type, pixel distribution area, image scene and other conditions of the current frame image, set three thresholds representing the proportion of each CTU in the current frame image among all CTUs: Frame_High, Frame_Mid, and Frame_Low. The percentage thresholds respectively record the percentages of the CTUs whose motion levels are "excessive motion, medium motion, and small motion" in all CTUs in the current frame image, and the recording range of this percentage can be 0 to 1. The three proportion thresholds can be set to different values according to the frame type, distribution area, scene and other conditions of the current frame image, where the default Frame_High=0.5, Frame_Mid=0.5, Frame_Low=0.5.
这里,在计算当前帧图像中每种运动特性的CTU在所有CTU中的占比前,需要先计算当前帧图像中每个CTU的运动特性。例如,可以通过将当前帧图像中当前CTU的运动矢量参数分量(Motion_cur)分别与第一预设运动矢量参数(Motion_Thred_High)和第二预设运动矢量参数(Motion_Thred_Low)进行比较来得到当前帧图像中每个CTU的运动特性。Here, before calculating the ratio of the CTU of each motion characteristic in the current frame image to all CTUs, the motion characteristic of each CTU in the current frame image needs to be calculated first. For example, the current frame image can be obtained by comparing the motion vector parameter component (Motion_cur) of the current CTU in the current frame image with the first preset motion vector parameter (Motion_Thred_High) and the second preset motion vector parameter (Motion_Thred_Low) Movement characteristics of each CTU.
例如,当前CTU的运动矢量参数分量是:Motion_cur,根据当前帧图像的帧类型、像素分布区域、图像场景等条件设置两个表示当前CTU的运动矢量大小的第一预设运动矢量参数:Motion_Thred_High和第二预设运动矢量参数:Motion_Thred_Low,其中,第一预设运动矢量参数和第二预设运动矢量参数分别记录的是运动矢量标量化的值。这里默认Motion_Thred_High=2500,Motion_Thred_Low=200,然后,将当前CTU的运动矢量参数(Motion_cur)分别与第一预设运动矢量参数(Motion_Thred_High)和第二预设运动矢量参数(Motion_Thred_Low)进行比较得到第二比较结果。如果第二比较结果表征当前CTU的运动矢量参数分量(Motion_cur)<第二预设运动矢量参数(Motion_Thred_Low),则认为当前CTU的运动级别属于较小运动;如果第二 比较结果表征:当前CTU的运动矢量参数分量(Motion_cur)>第一预设运动矢量参数(Motion_Thred_High),则认为当前CTU运动级别属于过大运动;如果第二比较结果表征:第二预设运动矢量参数(Motion_Thred_Low)<=当前CTU的运动矢量参数分量(Motion_cur)<=第一预设运动矢量参数(Motion_Thred_High),则认为当前CTU的运动级别属于中等运动。For example, the motion vector parameter component of the current CTU is: Motion_cur, and two first preset motion vector parameters representing the size of the current CTU motion vector are set according to the frame type, pixel distribution area, image scene, and other conditions of the current frame image: Motion_Thred_High and The second preset motion vector parameter: Motion_Thred_Low, wherein the first preset motion vector parameter and the second preset motion vector parameter respectively record the quantized values of the motion vector. Here, the default Motion_Thred_High=2500, Motion_Thred_Low=200, and then compare the motion vector parameter (Motion_cur) of the current CTU with the first preset motion vector parameter (Motion_Thred_High) and the second preset motion vector parameter (Motion_Thred_Low) to obtain the second Comparing results. If the second comparison result characterizes the motion vector parameter component of the current CTU (Motion_cur)<the second preset motion vector parameter (Motion_Thred_Low), the motion level of the current CTU is considered to be a smaller motion; if the second comparison result characterizes: the current CTU’s motion level Motion vector parameter component (Motion_cur)>First preset motion vector parameter (Motion_Thred_High), then the current CTU motion level is considered to be excessive motion; if the second comparison result is characterized: second preset motion vector parameter (Motion_Thred_Low)<=current The motion vector parameter component (Motion_cur) of the CTU <= the first preset motion vector parameter (Motion_Thred_High), it is considered that the current CTU motion level belongs to medium motion.
然后,将运动级别属于过大运动特性的CTU总数在当前帧图像中所有CTU总数的占比与占比阈值(Frame_High)进行比较,将运动级别属于中等运动特性的CTU总数在当前帧图像中所有CTU总数的占比与占比阈值(Frame_Mid)进行比较,将运动级别属于较小运动特性的CTU总数在当前帧图像中所有CTU总数的占比与占比阈值(Frame_Low)进行比较,得到第三比较结果。如果第三比较结果表征当前帧中运动级别属于较小运动特性的CTU总数在当前帧图像中所有CTU总数的占比>占比阈值(Frame_Low)时,那么认为当前帧图像的运动级别基本处于静止、较小运动,则当前帧图像的编码参数不作调整。这是因为对于较小运动特性的帧图像,常规的编码控制算法已经可以做得比较好了,所以不需要再对较小运动特性的视频码流进行再次编码调整。如果第三比较结果表征当前帧中运动级别属于过大运动特性的CTU总数在当前帧图像中所有CTU总数的占比>占比阈值(Frame_High)时,那么认为当前帧运动非常剧烈,也不对当前帧图像的编码参数作调整。这是因为对于运动过大的运动特性的帧图像,由于图像传感器中电荷耦合元件(Charge-coupled Device,CCD)或者互补金属氧化物半导体(Complementary Metal Oxide Semiconductor,CMOS)芯片的原因,无法从对应的参考帧图像中得到精确的运动矢量参数,因此去提升失真图像的编码质量,意义不大。如果第三比较结果表征当前帧中运动级别属于中等运动特性的CTU总数在当前帧图像中所有CTU总数的占比>占比阈值 (Frame_Mid)时,说明电子设备中的图像传感器可以从当前帧图像对应的参考帧图像中得到比较准确的运动矢量参数,那么认为当前帧图像的编码参数适合进行调整。Then, compare the proportion of the total number of CTUs whose motion level belongs to excessive motion characteristics in the current frame image with the ratio threshold (Frame_High), and compare the total number of CTUs whose motion level belongs to moderate motion characteristics in the current frame image The proportion of the total number of CTUs is compared with the proportion threshold (Frame_Mid), and the proportion of the total number of CTUs whose motion level belongs to the smaller motion characteristics in the current frame image is compared with the proportion threshold (Frame_Low) to obtain the third Comparing results. If the third comparison result indicates that the total number of CTUs whose motion level belongs to the smaller motion characteristics in the current frame accounts for the proportion of the total number of all CTUs in the current frame image> ratio threshold (Frame_Low), then the motion level of the current frame image is basically at rest , Small motion, the encoding parameters of the current frame image are not adjusted. This is because for frame images with smaller motion characteristics, the conventional coding control algorithm can already do better, so there is no need to re-encode and adjust video streams with smaller motion characteristics. If the third comparison result indicates that the total number of CTUs whose motion level belongs to excessive motion characteristics in the current frame accounts for the proportion of the total number of all CTUs in the current frame image> ratio threshold (Frame_High), then the current frame motion is considered to be very violent Adjust the encoding parameters of the frame image. This is because for frame images with excessive motion characteristics, due to the charge-coupled device (CCD) or complementary metal oxide semiconductor (Complementary Metal Oxide Semiconductor (CMOS)) chip in the image sensor, the corresponding The accurate motion vector parameters are obtained in the reference frame image of, so it is of little significance to improve the encoding quality of the distorted image. If the third comparison result indicates that the total number of CTUs in the current frame whose motion level belongs to moderate motion characteristics accounts for the total number of all CTUs in the current frame image> ratio threshold (Frame_Mid), it means that the image sensor in the electronic device can start from the current frame image More accurate motion vector parameters are obtained in the corresponding reference frame image, then the encoding parameters of the current frame image are considered suitable for adjustment.
例如,当前帧图像中所有CTU的数量为100个,通过将每个CTU的运动矢量参数分量分别与预设阈值(Motion_Thred_High和Motion_Thred_Low)进行比较得到的比较结果,确定当前帧图像中有51个CTU的运动级别属于中等运动,然后,再通过将该51个CTU在当前帧图像中所有CTU的占比与Frame_Mid进行比较,得到该51个CTU在当前帧图像中所有CTU的占比大于Frame_Mid的阈值时,则可以对当前帧图像中该51个CTU对应的编码参数进行调整。For example, the number of all CTUs in the current frame image is 100. By comparing the motion vector parameter components of each CTU with preset thresholds (Motion_Thred_High and Motion_Thred_Low), it is determined that there are 51 CTUs in the current frame image The level of motion belongs to medium sports, and then, by comparing the proportion of all CTUs in the current frame image of the 51 CTUs with Frame_Mid, the proportion of all CTUs in the current frame image of the 51 CTUs is greater than the threshold of Frame_Mid , You can adjust the coding parameters corresponding to the 51 CTUs in the current frame image.
本发明实施例中,为了在相邻两帧的帧图像之间遇到运动特性变化极大的场景时,能够实时地为当前帧图像提供更多码字,还可以在当前帧图像的运动级别不满足编码调整策略的时间达到预设时间时,确定该运动级别满足编码调整策略。此时,可以通过以下方式至少之一实现对当前帧图像的编码参数进行调整:增大当前帧图像对应的第一编码比特数、减小当前帧图像对应的QP值、增大当前帧图像中目标CTU对应的第二编码比特数、以及减小目标CTU对应的QP值。In the embodiment of the present invention, in order to encounter scenes with greatly varying motion characteristics between two adjacent frame images, it is possible to provide more code words for the current frame image in real time, and also to determine the motion level of the current frame image. When the time when the code adjustment strategy is not satisfied reaches the preset time, it is determined that the motion level meets the code adjustment strategy. At this time, the encoding parameters of the current frame image can be adjusted in at least one of the following ways: increasing the number of first encoded bits corresponding to the current frame image, decreasing the QP value corresponding to the current frame image, and increasing the current frame image The number of second coded bits corresponding to the target CTU, and decreasing the QP value corresponding to the target CTU.
例如,当前帧图像的运动级别处于较小运动或过大运动的时间达到10分钟时,可以通过以下方式至少之一实现对当前帧图像的编码参数进行调整:增大当前帧图像对应的第一编码比特数、减小当前帧图像对应的QP值、增大当前帧图像中目标CTU对应的第二编码比特数、以及减小目标CTU对应的QP值。For example, when the motion level of the current frame image is in small motion or excessive motion for 10 minutes, the encoding parameters of the current frame image can be adjusted in at least one of the following ways: increase the first corresponding to the current frame image The number of coded bits, decrease the QP value corresponding to the current frame image, increase the number of second coded bits corresponding to the target CTU in the current frame image, and decrease the QP value corresponding to the target CTU.
本发明实施例中,电子设备在通过减小当前帧图像对应的QP值的方式实现对当前帧图像的编码参数进行调整时,可以根据为当前帧图像分配的目标编码 比特数和当前帧图像中CTU的个数,增大当前帧图像中每个CTU对应的第二编码比特数;然后,根据增大后的第二编码比特数减小当前帧图像对应的QP值。In the embodiment of the present invention, when the electronic device adjusts the encoding parameters of the current frame image by reducing the QP value corresponding to the current frame image, the electronic device may be based on the target encoding bit number allocated to the current frame image and the current frame image. The number of CTUs increases the number of second encoded bits corresponding to each CTU in the current frame image; then, decreases the QP value corresponding to the current frame image according to the increased number of second encoded bits.
本发明实施例中,电子设备在对当前帧图像对应的第一编码比特数进行调整时,可以根据当前帧图像的运动级别调整为当前帧图像分配的码字。In the embodiment of the present invention, when adjusting the number of first encoded bits corresponding to the current frame image, the electronic device may adjust the codeword allocated to the current frame image according to the motion level of the current frame image.
例如,电子设备可以根据用户对视频图像设置的目标码率,计算该视频图像中每帧图像对应的目标比特数。在码率控制算法中,由于I帧图像对应的比特数通常比P帧图像多,所以I帧图像的比特数相当于所有帧图像的平均比特数需要乘以一个位数N,其中,N大于1,调整N值大小可以改变当前帧图像分配的码字。如果当前帧图像属于中等运动级别,则可以增加向当前帧图像分配的码字以保证当前帧图像的主观质量,N可以在原有基础上加1;如果当前视频帧序列没有运动级别或者运动级别为较小运动时,当前帧图像的前一帧图像需要消耗的码字较少,也可以适当的增加当前帧图像的码字,特别是I帧,则N可以在原有基础上加1;如果遇到突发场景时,也能够对当前帧图像实时进行编码参数调整,尤其是P帧,以避免常规控制算法的滞后性。For example, the electronic device may calculate the target bit number corresponding to each frame image in the video image according to the target bit rate set by the user on the video image. In the code rate control algorithm, since the number of bits corresponding to the I-frame image is usually more than that of the P-frame image, the number of bits in the I-frame image is equivalent to the average number of bits of all the frame images and needs to be multiplied by a single digit N, where N is greater than 1. Adjust the size of the N value to change the code word assigned to the current frame image. If the current frame image belongs to a medium motion level, the codeword assigned to the current frame image can be increased to ensure the subjective quality of the current frame image, and N can be increased by 1; if the current video frame sequence has no motion level or the motion level is When the motion is small, the previous frame image of the current frame image needs to consume less codewords, and the codeword of the current frame image can be appropriately increased, especially the I frame, then N can be increased by 1 on the original basis; When the scene is bursty, the encoding parameters of the current frame image can also be adjusted in real time, especially the P frame, to avoid the lag of the conventional control algorithm.
这里,I帧图像是指primary_pic_type(基本帧类型)值为0的图像;P帧图像是指primary_pic_type值为1的图像。视频帧序列是包含有1个以上帧图像的帧图像集合,该视频帧序列可以从第1帧图像到第M帧图像,M大于1;也可以从第100帧图像到第M帧图像,M大于100;还可以自定义该视频帧序列,且不用考虑当前帧图像之后的帧图像的调整所需要的码字。Here, the I-frame image refers to an image whose primary_pic_type (basic frame type) value is 0; the P-frame image refers to an image whose primary_pic_type value is 1. A video frame sequence is a collection of frame images that contains more than one frame image. The video frame sequence can be from the first frame image to the Mth frame image, M is greater than 1, or from the 100th frame image to the Mth frame image, M Greater than 100; you can also customize the video frame sequence without considering the codeword required for the adjustment of the frame image after the current frame image.
本发明实施例中,电子设备在调整当前帧图像对应的QP值时,可以通过将当前帧图像得到的目标比特数除以当前帧图像的分辨率,得到当前帧图像中平均每个像素所得到的目标比特位(Bits Per Pixel,BPP),这里,每个像素所得到的目标比特位是指存储每个像素所用的位数,是用来度量图像的分辨率的,又 称为图像的像素深度。通过当前帧图像中平均每个像素所得到的目标比特位计算当前帧图像对应的拉格郎日因子,从而根据计算出的拉格郎日因子来计算当前帧图像的QP值。In the embodiment of the present invention, when adjusting the QP value corresponding to the current frame image, the electronic device may obtain the average value of each pixel in the current frame image by dividing the target bit number obtained by the current frame image by the resolution of the current frame image The target bit (BitsPerPerPixel, BPP), here, the target bit obtained by each pixel refers to the number of bits used to store each pixel, is used to measure the resolution of the image, also known as the pixel of the image depth. The Lagrangian factor corresponding to the current frame image is calculated from the target bits obtained by averaging each pixel in the current frame image, so that the QP value of the current frame image is calculated according to the calculated Lagrange factor.
例如,通过下列公式1)计算当前帧图像中平均每个像素所得到的目标BPP:For example, the following formula 1) calculates the target BPP obtained by averaging each pixel in the current frame image:
Figure PCTCN2019126075-appb-000001
Figure PCTCN2019126075-appb-000001
其中,Target Bits是指当前图像序列中平均每帧图像得到的目标比特数,该目标比特数是由每秒钟的总比特数除以每秒钟的总帧数所得。N是自定义的倍数,W是当前帧图像的宽,H是当前帧图像的高。如果当前帧图像非第一帧图像,则该W和H的值可以由当前帧图像对应的前级模块输入,如果当前帧图像是第一帧图像,则W和H的值由系统输入。Among them, Target Bits refers to the target number of bits obtained by averaging each frame of the image in the current image sequence. The target bits are obtained by dividing the total number of bits per second by the total number of frames per second. N is a custom multiple, W is the width of the current frame image, and H is the height of the current frame image. If the current frame image is not the first frame image, the values of W and H can be input by the front-level module corresponding to the current frame image. If the current frame image is the first frame image, the values of W and H are input by the system.
然后,根据计算出的平均每个像素所得到的目标BPP,按下列公式2)计算当前帧图像对应的拉格朗日因子λ;Then, according to the calculated target BPP obtained by averaging each pixel, calculate the Lagrangian factor λ corresponding to the current frame image according to the following formula 2);
λ=α×BPP β      2) λ=α×BPP β 2)
其中,α和β是模型参数,α和β的值会根据当前帧图像的前一帧图像的实际编码结果不断地进行参数更新,得到λ之后再根据下列公式3)计算当前帧图像的QP。Among them, α and β are model parameters, and the values of α and β will be continuously updated according to the actual encoding result of the previous frame image of the current frame image, after obtaining λ, the QP of the current frame image is calculated according to the following formula 3).
当前帧图像的QP的计算方式为:The calculation method of the QP of the current frame image is:
QP=4.2005×ln(λ)+13.7122+0.5     3)QP=4.2005×ln(λ)+13.7122+0.5 3)
本发明实施例中,电子设备在对当前帧图像对应的第一编码比特数进行调整时,还可以根据当前帧图像的运动级别调整当前帧图像的QP值。In the embodiment of the present invention, when adjusting the number of first encoded bits corresponding to the current frame image, the electronic device may also adjust the QP value of the current frame image according to the motion level of the current frame image.
例如,如果发现当前帧图像的运动级别属于中等运动,或者当前帧图像中某个CTU的运动级别属于中等运动,则表明当前帧图像还可以通过更精细化的处理来增加少量的码字就能显著提高主观质量,那么就有必要将上述计算出的 当前帧图像的QP值调小。反之,如果当前帧图像的整体运动级别属于较小运动或者过大运动时,则表明当前帧图像的主观质量不能通过更精细化的处理来增加少量的码字就能显著提高,那么就没有必要调整上述计算出的当前帧图像的QP值。For example, if it is found that the motion level of the current frame image belongs to medium motion, or the motion level of a CTU in the current frame image belongs to moderate motion, it means that the current frame image can also be added by a small amount of codewords through more refined processing To significantly improve the subjective quality, then it is necessary to reduce the QP value of the current frame image calculated above. Conversely, if the overall motion level of the current frame image belongs to smaller motion or excessive motion, it means that the subjective quality of the current frame image cannot be significantly improved by more fine-grained processing by adding a small number of codewords, then there is no need Adjust the QP value of the current frame image calculated above.
本发明实施例中,通常为了保证当前帧图像的主观质量不出现较大波动,提高码率算法控制的鲁棒性,当前帧图像的QP值只进行微调。而当前帧图像的量化参数初始值,可以由上述三个公式得到,如果当前帧图像要进行编码参数调整时,当前帧图像的QP值可以在原基础上减1,反之,当前帧图像的QP值不变。In the embodiment of the present invention, in order to ensure that the subjective quality of the current frame image does not fluctuate greatly and improve the robustness of the code rate algorithm control, the QP value of the current frame image is only fine-tuned. The initial value of the quantization parameter of the current frame image can be obtained from the above three formulas. If the current frame image is to be adjusted for encoding parameters, the QP value of the current frame image can be reduced by 1 on the original basis, otherwise, the QP value of the current frame image constant.
本发明实施例中,电子设备在对当前帧图像的目标CTU对应的第二编码比特数进行调整和对当前帧图像中目标CTU对应的QP值中至少之一进行调整的方式,与对当前帧图像对应的第一编码比特数进行调整和对当前帧图像对应的QP值中至少之一进行调整的方法相同,也是在当前帧图像中目标CTU的运动级别属于中等运动时,适当的增加该目标CTU的目标比特数,该目标CTU的QP值可以在原基础上减1;如果当前帧图像中目标CTU的运动级别属于较小运动或过大运动时,该目标CTU的目标比特数和QP值不作调整。In the embodiment of the present invention, the electronic device adjusts at least one of the second coded bit number corresponding to the target CTU of the current frame image and the QP value corresponding to the target CTU in the current frame image in the same manner as the current frame. The method of adjusting the number of first encoded bits corresponding to the image is the same as the method of adjusting at least one of the QP values corresponding to the current frame image. It is also appropriate to increase the target when the motion level of the target CTU in the current frame image belongs to moderate motion The target bit number of the CTU, the QP value of the target CTU can be reduced by 1 on the original basis; if the motion level of the target CTU in the current frame image belongs to a small motion or an excessive motion, the target bit number and QP value of the target CTU are not used Adjustment.
本发明实施例中,为了避免实际码率和目标码率相差过大,可以选择只调整当前帧图像的第一编码比特数和当前帧图像的QP,或者只调整当前帧图像中目标CTU的第二编码比特数和目标CTU的QP值。In the embodiment of the present invention, in order to avoid an excessive difference between the actual code rate and the target code rate, it is possible to choose to adjust only the first encoded bit number of the current frame image and the QP of the current frame image, or only adjust the first CTU of the current frame image. Two coded bits and the QP value of the target CTU.
如此,通过本发明实施例提供的数据处理方法,能够在当前帧图像或当前帧图像中CTU的运动级别是中等运动时,对当前帧图像或当前帧图像中CTU的编码参数进行调整,如此,能够在带宽增加很少的情况下,显著提高当前帧图像的编码质量。In this way, through the data processing method provided by the embodiment of the present invention, when the motion level of the current frame image or the CTU in the current frame image is medium motion, the coding parameters of the current frame image or the CTU in the current frame image can be adjusted. It can significantly improve the encoding quality of the current frame image with little bandwidth increase.
图2为本发明实施例中数据处理方法的整体流程示意图。如图2所示,该流程如下:FIG. 2 is a schematic flowchart of a data processing method in an embodiment of the present invention. As shown in Figure 2, the process is as follows:
步骤201,前级模块输出数据; Step 201, the pre-level module outputs data;
这里,前级模块可以是当前帧图像对应的参考帧图像的图像信号处理(Image Signal Processing,ISP)模块。前级模块输出数据包括视频图像的数据信息和视频图像的全局运动统计信息。其中,全局运动统计信息可以是视频图像中所有帧图像对应的运动信息。Here, the preceding module may be an image signal processing (ISP) module of a reference frame image corresponding to the current frame image. The output data of the pre-module includes data information of the video image and global motion statistics information of the video image. The global motion statistics information may be motion information corresponding to all frame images in the video image.
步骤202,保存输出数据中的相关数据后,开始对当前帧图像进行编码;Step 202: After saving the relevant data in the output data, start encoding the current frame image;
这里,将当前帧图像按照预设图像分割单位划分成多个自定义大小的CTU区域,并根据每个CTU的内容对前级模块输出的全局运动统计信息进行滤波处理,得到与每个CTU的内容相匹配的目标区域。利用目标区域对应的运动统计信息对当前帧图像中对应的CTU进行运动估计,得到该CTU的运动矢量参数。Here, the current frame image is divided into multiple custom-sized CTU regions according to the preset image division unit, and the global motion statistics information output by the previous module is filtered according to the content of each CTU to obtain the The content matches the target area. The motion statistical information corresponding to the target area is used to perform motion estimation on the corresponding CTU in the current frame image to obtain the motion vector parameter of the CTU.
例如,当前帧图像是视频序列中的第n帧,当前帧图像对应的参考帧图像是视频序列中的第n-1帧。其中,第n-1帧中存在有与第n帧中区域A的内容相匹配的区域A'。这里,内容相匹配是指区域A的内容和区域A'的内容的误差小于预设阈值。For example, the current frame image is the nth frame in the video sequence, and the reference frame image corresponding to the current frame image is the n-1th frame in the video sequence. Among them, there is an area A′ in the n-1th frame that matches the content of the area A in the nth frame. Here, the content matching means that the error between the content of the area A and the content of the area A'is less than the preset threshold.
步骤203,判断当前帧图像中目标区域的运动特性是否是中等运动;Step 203: Determine whether the motion characteristic of the target area in the current frame image is medium motion;
这里,目标区域可以是将当前帧图像中一个或多个CTU,也可以是当前帧图像,也可以将当前帧图像中的一个或者多个slice(条带)。Here, the target area may be one or more CTUs in the current frame image, or may be the current frame image, or may be one or more slices in the current frame image.
这里,可以将当前帧图像中至少一个CTU对应的编码区域确定为目标区域,也可以将当前帧图像对应的整体编码区域确定为目标区域,还可以将当前帧图像划分成slices,一个slice包含一个slice segment(条带片段)或者以一个independent slice segment(独立条带片段)为首一系列的slice segments,slice由 一系列的coding tree units(编码树单元)组成,简称CTU(相当于以前宏块的概念)。也就是说,一个slice对应的编码区域确定为目标区域。Here, the coding area corresponding to at least one CTU in the current frame image may be determined as the target area, or the entire coding area corresponding to the current frame image may be determined as the target area, or the current frame image may be divided into slices, and one slice contains one slice (segment) or a series of slices beginning with an independent slice (segment), a slice is composed of a series of coding trees (coding tree units), referred to as CTU (equivalent to the previous macroblock concept). In other words, the coding area corresponding to a slice is determined as the target area.
当电子设备将当前帧图像中至少一个CTU对应的编码区域确定为目标区域时,可以将至少一个CTU对应的运动矢量参数分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第一比较结果,其中,第一预设运动矢量参数大于第二预设运动矢量参数;当第一比较结果表征当前帧图像中至少一个CTU对应的运动矢量参数小于或等于第一预设运动矢量参数、且大于或等于第二预设运动矢量参数时,确定当前帧图像中当前CTU对应的编码区域的运动特性为中等运动,则执行步骤205,反之,执行步骤204。When the electronic device determines the coding region corresponding to at least one CTU in the current frame image as the target region, the motion vector parameter corresponding to the at least one CTU may be compared with the first preset motion vector parameter and the second preset motion vector parameter, respectively To obtain a first comparison result, where the first preset motion vector parameter is greater than the second preset motion vector parameter; when the first comparison result indicates that the motion vector parameter corresponding to at least one CTU in the current frame image is less than or equal to the first preset When the motion vector parameter is greater than or equal to the second preset motion vector parameter, and it is determined that the motion characteristic of the coding region corresponding to the current CTU in the current frame image is medium motion, step 205 is performed; otherwise, step 204 is performed.
这里,当电子设备将当前帧图像对应的整体编码区域确定为目标区域时,可以将每个CTU对应的运动矢量参数分量分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第二比较结果;然后,根据第二比较结果,将小于或等于第一预设运动矢量参数、且大于或等于第二预设运动矢量参数的目标运动矢量参数对应的CTU,确定为当前帧图像中满足编码调整策略的目标CTU;再将目标CTU在当前帧图像中所有CTU的占比与预设占比进行比较,得到第三比较结果;当第三比较结果表征当前帧中运动级别属于中等运动特性的CTU总数在当前帧图像中所有CTU总数的占比>占比阈值(Frame_Mid)时,说明电子设备中的图像传感器可以从当前帧图像对应的参考帧图像中得到比较准确的运动矢量参数,那么认为当前帧图像的编码参数适合进行调整,则执行步骤205,反之,执行步骤204。Here, when the electronic device determines the overall coding region corresponding to the current frame image as the target region, the motion vector parameter component corresponding to each CTU may be compared with the first preset motion vector parameter and the second preset motion vector parameter, respectively To obtain the second comparison result; then, according to the second comparison result, the CTU corresponding to the target motion vector parameter less than or equal to the first preset motion vector parameter and greater than or equal to the second preset motion vector parameter is determined as the current The target CTU in the frame image that meets the coding adjustment strategy; then compare the proportion of the target CTU in the current frame image with all preset CTUs to obtain the third comparison result; when the third comparison result represents the motion level in the current frame When the ratio of the total number of CTUs belonging to medium motion characteristics to the total number of all CTUs in the current frame image> the ratio threshold (Frame_Mid), it means that the image sensor in the electronic device can get more accurate motion from the reference frame image corresponding to the current frame image For vector parameters, then the encoding parameters of the current frame image are considered suitable for adjustment, step 205 is performed, otherwise, step 204 is performed.
步骤204,当前区域的目标比特数不变。In step 204, the target number of bits in the current area remains unchanged.
步骤205,调整当前区域的目标比特数。Step 205: Adjust the target number of bits in the current area.
例如,可以通过以下方式至少之一实现对当前帧图像的编码参数进行调整: 增大当前帧图像中目标CTU对应的第二编码比特数和减小目标CTU对应的QP值。For example, the encoding parameter of the current frame image can be adjusted in at least one of the following ways: increase the number of second encoding bits corresponding to the target CTU in the current frame image and decrease the QP value corresponding to the target CTU.
或者,还可以通过以下方式至少之一实现对当前帧图像的编码参数进行调整:增大当前帧图像对应的第一编码比特数和减小当前帧图像对应的QP值。Alternatively, the encoding parameters of the current frame image can also be adjusted in at least one of the following ways: increase the number of first encoded bits corresponding to the current frame image and decrease the QP value corresponding to the current frame image.
步骤206,当前区域的QP值计算、调整和限幅;Step 206: Calculate, adjust and limit the QP value of the current area;
这里,当前区域的QP值的限幅范围通常是0-51,在一实施方式中,通常可以自定义限幅范围在16-48之间。当目标比特数增加时,QP值会随着减小或不变。Here, the limiting range of the QP value of the current region is usually 0-51. In one embodiment, the limiting range can be customized between 16-48. When the number of target bits increases, the QP value will decrease or stay the same.
为了保证当前帧图像的主观质量不出现较大波动,提高码率算法控制的鲁棒性,QP值只进行微调。因此,在得到调整后的QP值后,还需要将调整后的QP值与调整前的QP值进行比较,根据比较结果判断调整后的QP值是不是在预设的调整振幅内,如果比较结果表征调整后的QP值不在预设的调整振幅内时,则需要将调整后的QP值调整到预设的调整振幅内。In order to ensure that the subjective quality of the current frame image does not appear to fluctuate greatly and improve the robustness of the code rate algorithm control, the QP value is only fine-tuned. Therefore, after obtaining the adjusted QP value, it is also necessary to compare the adjusted QP value with the QP value before adjustment, and judge whether the adjusted QP value is within the preset adjustment amplitude according to the comparison result. When the adjusted QP value is not within the preset adjustment amplitude, the adjusted QP value needs to be adjusted to the preset adjustment amplitude.
这里,电子设备为了对当前区域进行更细化的调整,还会对调整后的QP值进行计算,通过计算结果确定当前QP值还可以进行一步的调整时,当前帧图像的QP值可以在原基础上减1,反之,当前帧图像的QP值不变。计算QP值的方法可以参考上述公式1、公式2和公式3)。Here, in order to make more detailed adjustments to the current area, the electronic device also calculates the adjusted QP value. When the current QP value is determined by the calculation result, it can be adjusted in one step. The QP value of the current frame image can be based on the original Decrease by one, otherwise, the QP value of the current frame image does not change. The method of calculating the QP value can refer to the above formula 1, formula 2 and formula 3).
例如,当根据当前帧图像的运动级别调整当前帧图像的QP值时,如果发现当前帧图像的运动级别属于中等运动,或者当前帧图像中某个CTU的运动级别属于中等运动,则表明当前帧图像还可以通过更精细化的处理来增加少量的码字就能显著提高主观质量,那么就有必要将上述计算出的当前帧图像的QP值调小。反之,如果当前帧图像的整体运动级别属于较小运动或者过大运动时,则表明当前帧图像的主观质量不能通过更精细化的处理来增加少量的码字就能显 著提高,那么就没有必要调整上述计算出的当前帧图像的QP值。For example, when the QP value of the current frame image is adjusted according to the motion level of the current frame image, if the motion level of the current frame image is found to be moderate motion, or the motion level of a CTU in the current frame image is moderate motion, it indicates that the current frame The image can also be improved through more refined processing to add a small number of codewords to significantly improve the subjective quality, then it is necessary to reduce the QP value of the current frame image calculated above. Conversely, if the overall motion level of the current frame image belongs to smaller motion or excessive motion, it means that the subjective quality of the current frame image cannot be significantly improved by more fine-grained processing by adding a small number of codewords, then there is no need Adjust the QP value of the current frame image calculated above.
步骤207,对当前帧图像的目标区域进行编码;Step 207, encode the target area of the current frame image;
步骤208,判断当前帧图像的编码是否结束;Step 208: Determine whether the encoding of the current frame image ends;
确定当前帧图像的编码结束时,执行步骤209;确定当前帧图像的编码未结束时,执行步骤210。When it is determined that the encoding of the current frame image ends, step 209 is performed; when it is determined that the encoding of the current frame image has not ended, step 210 is performed.
步骤209,判断当前帧序列的编码是否结束;Step 209: Determine whether the encoding of the current frame sequence ends;
确定当前帧序列的编码结束时,执行步骤211;确定当前帧序列的编码未结束时,执行步骤212;When it is determined that the encoding of the current frame sequence ends, step 211 is performed; when it is determined that the encoding of the current frame sequence has not ended, step 212 is performed;
步骤210,对当前帧图像中下一个区域进行编码处理;Step 210: Encode the next region in the current frame image;
这里,对当前帧图像中下一个区域进行编码处理时,重新执行步骤203-208。Here, when the next region in the current frame image is encoded, steps 203-208 are performed again.
步骤211,结束处理; Step 211, end the process;
步骤212,开始对下一帧图像进行编码处理。In step 212, the encoding process of the next frame image is started.
图3是本发明实施例中针对当前帧图像的帧级参数进行调整的流程示意图。如图3所示,包括以下步骤:FIG. 3 is a schematic flowchart of adjusting frame-level parameters of a current frame image in an embodiment of the present invention. As shown in Figure 3, it includes the following steps:
步骤301,前级模块输出数据; Step 301, the pre-module outputs data;
这里,前级模块可以是当前帧图像对应的参考帧图像的ISP模块。前级模块输出数据包括视频图像的数据信息和视频图像的全局运动统计信息。其中,全局运动统计信息可以是视频图像中所有帧图像对应的运动信息。Here, the pre-stage module may be an ISP module of the reference frame image corresponding to the current frame image. The output data of the pre-module includes data information of the video image and global motion statistics information of the video image. The global motion statistics information may be motion information corresponding to all frame images in the video image.
步骤302,保存输出数据中的相关数据后,开始对当前帧图像进行编码;Step 302: After saving the relevant data in the output data, start encoding the current frame image;
这里,将当前帧图像按照预设图像分割单位划分成多个自定义大小的CTU区域,并根据每个CTU的内容对前级模块输出的全局运动统计信息进行滤波处理,得到与每个CTU的内容相匹配的目标区域。利用目标区域对应的运动统计信息对当前帧图像中对应的CTU进行运动估计,得到该CTU的运动矢量参数。Here, the current frame image is divided into multiple custom-sized CTU areas according to the preset image division unit, and the global motion statistical information output by the preceding module is filtered according to the content of each CTU to obtain the The content matches the target area. The motion statistical information corresponding to the target area is used to perform motion estimation on the corresponding CTU in the current frame image to obtain the motion vector parameter of the CTU.
例如,当前帧图像是视频序列中的第n帧,当前帧图像对应的参考帧图像是视频序列中的第n-1帧。其中,第n-1帧中存在有与第n帧中区域A的内容相匹配的区域A'。这里,内容相匹配是指区域A的内容和区域A'的内容的误差小于预设阈值。For example, the current frame image is the nth frame in the video sequence, and the reference frame image corresponding to the current frame image is the n-1th frame in the video sequence. Among them, there is an area A′ in the n-1th frame that matches the content of the area A in the nth frame. Here, the content matching means that the error between the content of the area A and the content of the area A'is less than the preset threshold.
步骤303,判断当前帧图像的运动特性是否是中等运动;Step 303: Determine whether the motion characteristic of the current frame image is medium motion;
这里,可以先对当前帧图像划分为多个大小相等的CTU,然后,将每个CTU对应的运动矢量参数分量分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第二比较结果;然后,根据第二比较结果,将小于或等于第一预设运动矢量参数、且大于或等于第二预设运动矢量参数的目标运动矢量参数对应的CTU,确定为当前帧图像中满足编码调整策略的目标CTU;再将目标CTU在当前帧图像中所有CTU的占比与预设占比进行比较,得到第三比较结果;当第三比较结果表征当前帧中运动级别属于中等运动特性的CTU总数在当前帧图像中所有CTU总数的占比>占比阈值(Frame_Mid)时,说明电子设备中的图像传感器可以从当前帧图像对应的参考帧图像中得到比较准确的运动矢量参数,那么认为当前帧图像的编码参数适合进行调整,则执行步骤305;当第三比较结果表征当前帧中运动级别属于中等运动特性的CTU总数在当前帧图像中所有CTU总数的占比小于/等于占比阈值(Frame_Mid)时,执行步骤304。Here, the current frame image may be first divided into multiple CTUs of equal size, and then, the motion vector parameter components corresponding to each CTU are compared with the first preset motion vector parameter and the second preset motion vector parameter, respectively, to obtain The second comparison result; then, according to the second comparison result, the CTU corresponding to the target motion vector parameter less than or equal to the first preset motion vector parameter and greater than or equal to the second preset motion vector parameter is determined as the current frame image Meet the target CTU of the coding adjustment strategy; then compare the proportion of the target CTU in the current frame image with all preset CTUs to obtain the third comparison result; when the third comparison result indicates that the motion level in the current frame is medium When the ratio of the total number of CTUs of the motion characteristics to the total number of all CTUs in the current frame image> the ratio threshold (Frame_Mid), it means that the image sensor in the electronic device can obtain more accurate motion vector parameters from the reference frame image corresponding to the current frame image , Then it is considered that the encoding parameters of the current frame image are suitable for adjustment, then step 305 is performed; when the third comparison result indicates that the total number of CTUs whose motion level in the current frame belongs to moderate motion characteristics accounts for less than/equal to the total number of CTUs in the current frame image When the ratio threshold (Frame_Mid) is reached, step 304 is executed.
步骤304,当前帧图像的目标比特数不变。 Step 304, the target bit number of the current frame image is unchanged.
步骤305,调整当前帧图像的目标比特数。Step 305: Adjust the target bit number of the current frame image.
例如,可以通过以下方式至少之一实现对当前帧图像的编码参数进行调整:增大当前帧图像对应的第一编码比特数和减小当前帧图像对应的QP值。For example, the encoding parameter of the current frame image can be adjusted in at least one of the following ways: increase the number of first encoded bits corresponding to the current frame image and decrease the QP value corresponding to the current frame image.
步骤306,帧图像的QP值的计算、调整和限幅; Step 306, the calculation, adjustment and limiting of the QP value of the frame image;
这里,帧图像的QP值的限幅范围通常是0-51,在一实施方式中,通常可以 自定义帧图像的限幅范围在16-48之间。当目标比特数增加时,QP值会随着减小或不变。Here, the limit range of the QP value of the frame image is usually 0-51. In one embodiment, the limit range of the frame image can be customized between 16-48. When the number of target bits increases, the QP value will decrease or stay the same.
为了保证当前帧图像的主观质量不出现较大波动,提高码率算法控制的鲁棒性,QP值只进行微调。因此,在得到调整后的QP值后,还需要将调整后的QP值与调整前的QP值进行比较,根据比较结果判断调整后的QP值是不是在预设的调整振幅内,如果比较结果表征调整后的QP值不在预设的调整振幅内时,则需要将调整后的QP值调整到预设的调整振幅内。In order to ensure that the subjective quality of the current frame image does not appear to fluctuate greatly and improve the robustness of the code rate algorithm control, the QP value is only fine-tuned. Therefore, after obtaining the adjusted QP value, it is also necessary to compare the adjusted QP value with the QP value before adjustment, and judge whether the adjusted QP value is within the preset adjustment amplitude according to the comparison result. When the adjusted QP value is not within the preset adjustment amplitude, the adjusted QP value needs to be adjusted to the preset adjustment amplitude.
这里,电子设备为了对当前帧图像进行更细化的调整,还会对调整后的QP值进行计算,通过计算结果确定当前QP值还可以进行一步的调整时,当前帧图像的QP值可以在原基础上减1,反之,当前帧图像的QP值不变。计算QP值的方法可以参考上述公式1、公式2和公式3)。Here, in order to make more detailed adjustments to the current frame image, the electronic device also calculates the adjusted QP value. When the current QP value is determined by the calculation result, it can be further adjusted. The QP value of the current frame image can be in the original On the basis of minus 1, otherwise, the QP value of the current frame image is unchanged. The method of calculating the QP value can refer to the above formula 1, formula 2 and formula 3).
例如,当根据当前帧图像的运动级别调整当前帧图像的QP值时,如果发现当前帧图像的运动级别属于中等运动,或者当前帧图像中某个CTU的运动级别属于中等运动,则表明当前帧图像还可以通过更精细化的处理来增加少量的码字就能显著提高主观质量,那么就有必要将上述计算出的当前帧图像的QP值调小。反之,如果当前帧图像的整体运动级别属于较小运动或者过大运动时,则表明当前帧图像的主观质量不能通过更精细化的处理来增加少量的码字就能显著提高,那么就没有必要调整上述计算出的当前帧图像的QP值。For example, when the QP value of the current frame image is adjusted according to the motion level of the current frame image, if the motion level of the current frame image is found to be moderate motion, or the motion level of a CTU in the current frame image is moderate motion, it indicates that the current frame The image can also be improved through more refined processing to add a small number of codewords to significantly improve the subjective quality, then it is necessary to reduce the QP value of the current frame image calculated above. Conversely, if the overall motion level of the current frame image belongs to smaller motion or excessive motion, it means that the subjective quality of the current frame image cannot be significantly improved by more fine-grained processing by adding a small number of codewords, then there is no need Adjust the QP value of the current frame image calculated above.
步骤307,对当前帧图像进行编码; Step 307, encode the current frame image;
步骤308,判断当前帧图像的编码是否结束;Step 308: Determine whether the encoding of the current frame image ends;
确定当前帧图像的编码结束时,执行步骤309;确定当前帧图像的编码未结束时,继续执行步骤309。When it is determined that the encoding of the current frame image ends, step 309 is performed; when it is determined that the encoding of the current frame image has not ended, step 309 is continued.
步骤309,判断当前帧序列的编码是否结束;Step 309: Determine whether the encoding of the current frame sequence ends;
确定当前帧序列的编码结束时,执行步骤310;确定当前帧序列的编码未结束时,执行步骤311;When it is determined that the encoding of the current frame sequence ends, step 310 is performed; when it is determined that the encoding of the current frame sequence has not ended, step 311 is performed;
步骤310,结束处理; Step 310, end the process;
步骤311,开始对下一帧图像进行编码处理。In step 311, the encoding process of the next frame image is started.
图4是本发明实施例中针对当前帧图像的CTU能参数进行调整的流程示意图。如图4所示,包括以下步骤:FIG. 4 is a schematic flowchart of adjusting the CTU performance parameter of the current frame image in the embodiment of the present invention. As shown in Figure 4, it includes the following steps:
步骤401,前级模块输出数据; Step 401, the pre-module outputs data;
这里,前级模块可以是当前帧图像对应的参考帧图像的ISP模块。前级模块输出数据包括视频图像的数据信息和视频图像的全局运动统计信息。其中,全局运动统计信息可以是视频图像中所有帧图像对应的运动信息。Here, the pre-stage module may be an ISP module of the reference frame image corresponding to the current frame image. The output data of the pre-module includes data information of the video image and global motion statistics information of the video image. The global motion statistics information may be motion information corresponding to all frame images in the video image.
步骤402,保存输出数据中的相关数据后,开始对当前帧图像进行编码;Step 402: After saving the relevant data in the output data, start encoding the current frame image;
这里,将当前帧图像按照预设图像分割单位划分成多个自定义大小的CTU区域,并根据每个CTU的内容对前级模块输出的全局运动统计信息进行滤波处理,得到与每个CTU的内容相匹配的目标区域。利用目标区域对应的运动统计信息对当前帧图像中对应的CTU进行运动估计,得到该CTU的运动矢量参数。Here, the current frame image is divided into multiple custom-sized CTU regions according to the preset image division unit, and the global motion statistics information output by the previous module is filtered according to the content of each CTU to obtain the The content matches the target area. The motion statistical information corresponding to the target area is used to perform motion estimation on the corresponding CTU in the current frame image to obtain the motion vector parameter of the CTU.
例如,当前帧图像是视频序列中的第n帧,当前帧图像对应的参考帧图像是视频序列中的第n-1帧。其中,第n-1帧中存在有与第n帧中区域A的内容相匹配的区域A'。这里,内容相匹配是指区域A的内容和区域A'的内容的误差小于预设阈值。For example, the current frame image is the nth frame in the video sequence, and the reference frame image corresponding to the current frame image is the n-1th frame in the video sequence. Among them, there is an area A′ in the n-1th frame that matches the content of the area A in the nth frame. Here, the content matching means that the error between the content of the area A and the content of the area A'is less than the preset threshold.
步骤403,判断当前帧图像中每个CTU的运动特性是否是中等运动;Step 403: Determine whether the motion characteristic of each CTU in the current frame image is medium motion;
这里,可以先对当前帧图像划分为多个大小相等的CTU,然后,将至少一个CTU对应的运动矢量参数分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第一比较结果,其中,第一预设运动矢量参数大于第二预 设运动矢量参数;当第一比较结果表征当前帧图像中至少一个CTU对应的运动矢量参数小于或等于第一预设运动矢量参数、且大于或等于第二预设运动矢量参数时,确定当前帧图像中当前CTU对应的编码区域的运动特性为中等运动,则执行步骤405;当第一比较结果表征当前帧图像中至少一个CTU对应的运动矢量参数大于第一预设运动矢量参数、且小于第二预设运动矢量参数时,确定当前帧图像中当前CTU对应的编码区域的运动特性非中等运动,执行步骤404。Here, the current frame image may be divided into multiple CTUs of equal size, and then, the motion vector parameters corresponding to at least one CTU are compared with the first preset motion vector parameter and the second preset motion vector parameter, respectively, to obtain the first A comparison result, where the first preset motion vector parameter is greater than the second preset motion vector parameter; when the first comparison result indicates that the motion vector parameter corresponding to at least one CTU in the current frame image is less than or equal to the first preset motion vector parameter , And greater than or equal to the second preset motion vector parameter, it is determined that the motion characteristic of the coding region corresponding to the current CTU in the current frame image is medium motion, then step 405 is performed; when the first comparison result represents at least one CTU in the current frame image When the corresponding motion vector parameter is greater than the first preset motion vector parameter and less than the second preset motion vector parameter, it is determined that the motion characteristic of the coding region corresponding to the current CTU in the current frame image is not moderate motion, and step 404 is executed.
步骤404,当前CTU的目标比特数不变。In step 404, the current CTU target bit number remains unchanged.
步骤405,调整当前CTU的目标比特数。Step 405: Adjust the current CTU target bit number.
例如,可以通过以下方式至少之一实现对当前CTU的编码参数进行调整:增大当前CTU对应的第二编码比特数和减小当前CTU对应的QP值。For example, the encoding parameter of the current CTU may be adjusted in at least one of the following ways: increase the number of second encoded bits corresponding to the current CTU and decrease the QP value corresponding to the current CTU.
步骤406,当前CTU的QP值的计算、调整和限幅;Step 406: Calculate, adjust, and limit the QP value of the current CTU;
这里,当前CTU的QP值的限幅范围通常是0-51,在一实施方式中,通常可以自定义限幅范围在16-48之间。当目标比特数增加时,QP值会随着减小或不变。Here, the limiting range of the current QP value of the CTU is usually 0-51. In one embodiment, the limiting range can usually be customized between 16-48. When the number of target bits increases, the QP value will decrease or stay the same.
为了保证当前帧图像的主观质量不出现较大波动,提高码率算法控制的鲁棒性,QP值只进行微调。因此,在得到调整后的QP值后,还需要将调整后的QP值与调整前的QP值进行比较,根据比较结果判断调整后的QP值是不是在预设的调整振幅内,如果比较结果表征调整后的QP值不在预设的调整振幅内时,则需要将调整后的QP值调整到预设的调整振幅内。In order to ensure that the subjective quality of the current frame image does not appear to fluctuate greatly and improve the robustness of the code rate algorithm control, the QP value is only fine-tuned. Therefore, after obtaining the adjusted QP value, it is also necessary to compare the adjusted QP value with the QP value before adjustment, and judge whether the adjusted QP value is within the preset adjustment amplitude according to the comparison result. When the adjusted QP value is not within the preset adjustment amplitude, the adjusted QP value needs to be adjusted to the preset adjustment amplitude.
这里,电子设备为了对当前CTU进行更细化的调整,还会对调整后的QP值进行计算,通过计算结果确定当前QP值还可以进行一步的调整时,当前CTU的QP值可以在原基础上减1,反之,当前CTU的QP值不变。计算QP值的方法可以参考上述公式1、公式2和公式3)。Here, in order to make more detailed adjustments to the current CTU, the electronic device also calculates the adjusted QP value. When the current QP value can be adjusted through the calculation result, the current CTU QP value can be adjusted on the original basis. Decrease by one, otherwise, the current QP value of CTU remains unchanged. The method of calculating the QP value can refer to the above formula 1, formula 2 and formula 3).
例如,当根据当前CTU的运动级别调整当前CTU的QP值时,如果发现当前CTU的运动级别属于中等运动,或者当前CTU中某个CTU的运动级别属于中等运动,则表明当前CTU还可以通过更精细化的处理来增加少量的码字就能显著提高主观质量,那么就有必要将上述计算出的当前CTU的QP值调小。反之,如果当前CTU的整体运动级别属于较小运动或者过大运动时,则表明当前CTU的主观质量不能通过更精细化的处理来增加少量的码字就能显著提高,那么就没有必要调整上述计算出的当前CTU的QP值。For example, when the QP value of the current CTU is adjusted according to the current CTU's sports level, if the current CTU's sports level is found to be medium-level sports, or if the current CTU's sports level belongs to medium-level sports, it indicates that the current CTU can also be changed Refined processing to add a small number of codewords can significantly improve the subjective quality, then it is necessary to adjust the QP value of the current CTU calculated above to be small. On the contrary, if the current overall motion level of the CTU belongs to a smaller motion or an excessive motion, it means that the subjective quality of the current CTU cannot be significantly improved by adding a small number of codewords through more elaborate processing, so there is no need to adjust the above The calculated QP value of the current CTU.
步骤407,对当前CTU进行编码; Step 407, encoding the current CTU;
步骤408,判断当前CTU的编码是否结束;Step 408: Determine whether the current CTU encoding is ended;
确定当前CTU的编码结束时,执行步骤409;确定当前CTU的编码未结束时,执行步骤410。When it is determined that the encoding of the current CTU is completed, step 409 is performed; when it is determined that the encoding of the current CTU is not ended, step 410 is performed.
步骤409,判断当前帧序列的编码是否结束;Step 409: Determine whether the encoding of the current frame sequence ends;
确定当前帧序列的编码结束时,执行步骤411;确定当前帧序列的编码未结束时,执行步骤412;When it is determined that the encoding of the current frame sequence ends, step 411 is performed; when it is determined that the encoding of the current frame sequence has not ended, step 412 is performed;
步骤410,开始对当前帧图像中的下一CTU进行编码处理; Step 410, start coding the next CTU in the current frame image;
这里,开始对当前帧图像中的下一CTU进行编码处理时,重复执行步骤403-408。Here, when starting to encode the next CTU in the current frame image, steps 403-408 are repeatedly performed.
步骤411,结束处理; Step 411, end the process;
步骤412,开始对下一帧图像进行编码处理。In step 412, the encoding process of the next frame image is started.
图5是本发明实施例中针对当前帧图像的帧级参数和CTU级参数协同调整的流程示意图。如图5所示,包括以下步骤:FIG. 5 is a schematic flow chart of collaborative adjustment of the frame-level parameters and CTU-level parameters of the current frame image in the embodiment of the present invention. As shown in Figure 5, it includes the following steps:
步骤501,前级模块输出数据; Step 501, the pre-module outputs data;
这里,前级模块可以是当前帧图像对应的参考帧图像的ISP模块。前级模 块输出数据包括视频图像的数据信息和视频图像的全局运动统计信息。其中,全局运动统计信息可以是视频图像中所有帧图像对应的运动信息。Here, the pre-stage module may be an ISP module of the reference frame image corresponding to the current frame image. The output data of the previous module includes the data information of the video image and the global motion statistics of the video image. The global motion statistics information may be motion information corresponding to all frame images in the video image.
步骤502,保存输出数据中的相关数据后,开始对当前帧图像进行编码;Step 502: After saving the relevant data in the output data, start encoding the current frame image;
这里,将当前帧图像按照预设图像分割单位划分成多个自定义大小的CTU区域,并根据每个CTU的内容对前级模块输出的全局运动统计信息进行滤波处理,得到与每个CTU的内容相匹配的目标区域。利用目标区域对应的运动统计信息对当前帧图像中对应的CTU进行运动估计,得到该CTU的运动矢量参数。Here, the current frame image is divided into multiple custom-sized CTU regions according to the preset image division unit, and the global motion statistics information output by the previous module is filtered according to the content of each CTU to obtain the The content matches the target area. The motion statistical information corresponding to the target area is used to perform motion estimation on the corresponding CTU in the current frame image to obtain the motion vector parameter of the CTU.
例如,当前帧图像是视频序列中的第n帧,当前帧图像对应的参考帧图像是视频序列中的第n-1帧。其中,第n-1帧中存在有与第n帧中区域A的内容相匹配的区域A'。这里,内容相匹配是指区域A的内容和区域A'的内容的误差小于预设阈值。For example, the current frame image is the nth frame in the video sequence, and the reference frame image corresponding to the current frame image is the n-1th frame in the video sequence. Among them, there is an area A′ in the n-1th frame that matches the content of the area A in the nth frame. Here, the content matching means that the error between the content of the area A and the content of the area A'is less than the preset threshold.
步骤503,判断当前帧图像的运动特性是否是中等运动;Step 503: Determine whether the motion characteristic of the current frame image is medium motion;
这里,可以先对当前帧图像划分为多个大小相等的CTU,然后,将每个CTU对应的运动矢量参数分量分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第二比较结果;根据第二比较结果,将小于或等于第一预设运动矢量参数、且大于或等于第二预设运动矢量参数的目标运动矢量参数对应的CTU,确定为当前帧图像中满足编码调整策略的目标CTU;再将目标CTU在当前帧图像中所有CTU的占比与预设占比进行比较,得到第三比较结果;当第三比较结果表征当前帧中运动级别属于中等运动特性的CTU总数在当前帧图像中所有CTU总数的占比>占比阈值(Frame_Mid)时,说明电子设备中的图像传感器可以从当前帧图像对应的参考帧图像中得到比较准确的运动矢量参数,那么认为当前帧图像的编码参数适合进行调整,则执行步骤305;当第三比较结果表征当前帧中运动级别属于中等运动特性的CTU总数在当前帧图像中所有 CTU总数的占比小于/等于占比阈值(Frame_Mid)时,执行步骤504。Here, the current frame image may be first divided into multiple CTUs of equal size, and then, the motion vector parameter components corresponding to each CTU are compared with the first preset motion vector parameter and the second preset motion vector parameter, respectively, to obtain The second comparison result; according to the second comparison result, the CTU corresponding to the target motion vector parameter less than or equal to the first preset motion vector parameter and greater than or equal to the second preset motion vector parameter is determined to be satisfied in the current frame image The target CTU of the coding adjustment strategy; then compare the proportion of all CTUs in the current frame image of the target CTU with the preset ratio to obtain the third comparison result; when the third comparison result indicates that the motion level in the current frame belongs to the medium motion characteristic When the ratio of the total number of CTUs in the current frame image to the total number of all CTUs> frame threshold (Frame_Mid), it means that the image sensor in the electronic device can get more accurate motion vector parameters from the reference frame image corresponding to the current frame image, then If it is considered that the encoding parameters of the current frame image are suitable for adjustment, step 305 is performed; when the third comparison result indicates that the total number of CTUs in the current frame whose motion level belongs to moderate motion characteristics accounts for less than/equal to the total number of all CTUs in the current frame image When the threshold (Frame_Mid) is reached, step 504 is executed.
步骤504,当前帧图像的目标比特数不变。 Step 504, the target bit number of the current frame image is unchanged.
步骤505,调整当前帧图像的目标比特数。Step 505: Adjust the target bit number of the current frame image.
例如,可以通过以下方式至少之一实现对当前帧图像的编码参数进行调整:增大当前帧图像对应的第一编码比特数和减小当前帧图像对应的QP值。For example, the encoding parameter of the current frame image can be adjusted in at least one of the following ways: increase the number of first encoded bits corresponding to the current frame image and decrease the QP value corresponding to the current frame image.
步骤506,当前帧图像QP值的计算、调整和限幅;Step 506: Calculate, adjust and limit the QP value of the current frame image;
这里,QP值的限幅范围通常是0-51,在一实施方式中,通常可以自定义限幅范围在16-48之间。当目标比特数增加时,QP值会随着减小或不变。Here, the limiting range of the QP value is usually 0-51. In an embodiment, the limiting range can usually be customized between 16-48. When the number of target bits increases, the QP value will decrease or stay the same.
为了保证当前帧图像的主观质量不出现较大波动,提高码率算法控制的鲁棒性,QP值只进行微调。因此,在得到调整后的QP值后,还需要将调整后的QP值与调整前的QP值进行比较,根据比较结果判断调整后的QP值是不是在预设的调整振幅内,如果比较结果表征调整后的QP值不在预设的调整振幅内时,则需要将调整后的QP值调整到预设的调整振幅内。In order to ensure that the subjective quality of the current frame image does not appear to fluctuate greatly and improve the robustness of the code rate algorithm control, the QP value is only fine-tuned. Therefore, after obtaining the adjusted QP value, it is also necessary to compare the adjusted QP value with the QP value before adjustment, and judge whether the adjusted QP value is within the preset adjustment amplitude according to the comparison result. When the adjusted QP value is not within the preset adjustment amplitude, the adjusted QP value needs to be adjusted to the preset adjustment amplitude.
这里,电子设备为了对当前帧图像进行更细化的调整,还会对调整后的QP值进行计算,通过计算结果确定当前QP值还可以进行一步的调整时,当前帧图像的QP值可以在原基础上减1,反之,当前帧图像的QP值不变。计算QP值的方法可以参考上述公式1、公式2和公式3)。Here, in order to make more detailed adjustments to the current frame image, the electronic device also calculates the adjusted QP value. When the current QP value is determined by the calculation result, it can be further adjusted. The QP value of the current frame image can be in the original On the basis of minus 1, otherwise, the QP value of the current frame image is unchanged. The method of calculating the QP value can refer to the above formula 1, formula 2 and formula 3).
例如,当根据当前帧图像的运动级别调整当前帧图像的QP值时,如果发现当前帧图像的运动级别属于中等运动,或者当前帧图像中某个CTU的运动级别属于中等运动,则表明当前帧图像还可以通过更精细化的处理来增加少量的码字就能显著提高主观质量,那么就有必要将上述计算出的当前帧图像的QP值调小。反之,如果当前帧图像的整体运动级别属于较小运动或者过大运动时,则表明当前帧图像的主观质量不能通过更精细化的处理来增加少量的码字就能显 著提高,那么就没有必要调整上述计算出的当前帧图像的QP值。For example, when the QP value of the current frame image is adjusted according to the motion level of the current frame image, if the motion level of the current frame image is found to be moderate motion, or the motion level of a CTU in the current frame image is moderate motion, it indicates that the current frame The image can also be improved through more refined processing to add a small number of codewords to significantly improve the subjective quality, then it is necessary to reduce the QP value of the current frame image calculated above. Conversely, if the overall motion level of the current frame image belongs to smaller motion or excessive motion, it means that the subjective quality of the current frame image cannot be significantly improved by more fine-grained processing by adding a small number of codewords, then there is no need Adjust the QP value of the current frame image calculated above.
步骤507,判断当前帧图像中每个CTU的运动特性是否是中等运动;Step 507: Determine whether the motion characteristic of each CTU in the current frame image is medium motion;
这里,还可以根据当前帧图像中每个CTU的运动特性对当前帧图像进行局部微调,即将运动特性是中等运动的CTU对应的编码区域进行调整。Here, the current frame image may also be locally fine-tuned according to the motion characteristics of each CTU in the current frame image, that is, the coding region corresponding to the CTU whose motion characteristics are medium motion may be adjusted.
例如,可以先对当前帧图像划分为多个大小相等的CTU,然后,将至少一个CTU对应的运动矢量参数分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第一比较结果,其中,第一预设运动矢量参数大于第二预设运动矢量参数;当第一比较结果表征当前帧图像中至少一个CTU对应的运动矢量参数小于或等于第一预设运动矢量参数、且大于或等于第二预设运动矢量参数时,确定当前帧图像中当前CTU对应的编码区域的运动特性为中等运动,则执行步骤509;当第一比较结果表征当前帧图像中至少一个CTU对应的运动矢量参数大于第一预设运动矢量参数、且小于第二预设运动矢量参数时,确定当前帧图像中当前CTU对应的编码区域的运动特性非中等运动,执行步骤508。For example, you can first divide the current frame image into multiple CTUs of equal size, and then compare the motion vector parameters corresponding to at least one CTU with the first preset motion vector parameter and the second preset motion vector parameter, respectively, to obtain the first A comparison result, where the first preset motion vector parameter is greater than the second preset motion vector parameter; when the first comparison result indicates that the motion vector parameter corresponding to at least one CTU in the current frame image is less than or equal to the first preset motion vector parameter , And greater than or equal to the second preset motion vector parameter, it is determined that the motion characteristic of the coding region corresponding to the current CTU in the current frame image is medium motion, then step 509 is performed; when the first comparison result represents at least one CTU in the current frame image When the corresponding motion vector parameter is greater than the first preset motion vector parameter and less than the second preset motion vector parameter, it is determined that the motion characteristic of the coding region corresponding to the current CTU in the current frame image is not moderate motion, and step 508 is executed.
步骤508,当前CTU的目标比特数不变。In step 508, the current CTU target bit number remains unchanged.
步骤509,调整当前CTU的目标比特数。Step 509: Adjust the target bit number of the current CTU.
例如,可以通过以下方式至少之一实现对当前CTU的编码参数进行调整:增大当前CTU对应的第二编码比特数和减小当前CTU对应的QP值。For example, the encoding parameter of the current CTU may be adjusted in at least one of the following ways: increase the number of second encoded bits corresponding to the current CTU and decrease the QP value corresponding to the current CTU.
步骤510,当前CTU的QP值的计算、调整和限幅; Step 510, the calculation, adjustment and limiting of the current CTU QP value;
这里,当前CTU的QP值的限幅范围通常是0-51,在一实施方式中,通常可以自定义限幅范围在16-48之间。当目标比特数增加时,QP值会随着减小或不变。Here, the limiting range of the current QP value of the CTU is usually 0-51. In one embodiment, the limiting range can usually be customized between 16-48. When the number of target bits increases, the QP value will decrease or stay the same.
为了保证当前帧图像的主观质量不出现较大波动,提高码率算法控制的鲁棒性,当前CTU的QP值只进行微调。因此,在得到调整后的QP值后,还需 要将调整后的QP值与调整前的QP值进行比较,根据比较结果判断调整后的QP值是不是在预设的调整振幅内,如果比较结果表征调整后的QP值不在预设的调整振幅内时,则需要将调整后的QP值调整到预设的调整振幅内。In order to ensure that the subjective quality of the current frame image does not fluctuate greatly and improve the robustness of the code rate algorithm control, the current CTU QP value is only fine-tuned. Therefore, after obtaining the adjusted QP value, it is also necessary to compare the adjusted QP value with the QP value before adjustment, and judge whether the adjusted QP value is within the preset adjustment amplitude according to the comparison result. When the adjusted QP value is not within the preset adjustment amplitude, the adjusted QP value needs to be adjusted to the preset adjustment amplitude.
这里,电子设备为了对当前CTU进行更细化的调整,还会对调整后的QP值进行计算,通过计算结果确定当前QP值还可以进行一步的调整时,当前CTU的QP值可以在原基础上减1,反之,当前CTU的QP值不变。计算QP值的方法可以参考上述公式1、公式2和公式3)。Here, in order to make more detailed adjustments to the current CTU, the electronic device also calculates the adjusted QP value. When the current QP value can be adjusted through the calculation result, the current CTU QP value can be adjusted on the original basis. Decrease by one, otherwise, the current QP value of CTU remains unchanged. The method of calculating the QP value can refer to the above formula 1, formula 2 and formula 3).
例如,当根据当前CTU的运动级别调整当前CTU的QP值时,如果发现当前CTU的运动级别属于中等运动,或者当前CTU中某个CTU的运动级别属于中等运动,则表明当前CTU还可以通过更精细化的处理来增加少量的码字就能显著提高主观质量,那么就有必要将上述计算出的当前CTU的QP值调小。反之,如果当前CTU的整体运动级别属于较小运动或者过大运动时,则表明当前CTU的主观质量不能通过更精细化的处理来增加少量的码字就能显著提高,那么就没有必要调整上述计算出的当前CTU的QP值。For example, when the QP value of the current CTU is adjusted according to the current CTU's sports level, if the current CTU's sports level is found to be medium-level sports, or if the current CTU's sports level belongs to medium-level sports, it indicates that the current CTU can also be changed Refined processing to add a small number of codewords can significantly improve the subjective quality, then it is necessary to adjust the QP value of the current CTU calculated above to be small. On the contrary, if the current overall motion level of the CTU belongs to a smaller motion or an excessive motion, it means that the subjective quality of the current CTU cannot be significantly improved by adding a small number of codewords through more elaborate processing, so there is no need to adjust the above The calculated QP value of the current CTU.
步骤511,和对当前CTU进行编码; Step 511, and encode the current CTU;
步骤512,判断当前CTU的编码是否结束;Step 512: Determine whether the current CTU encoding is ended;
确定当前CTU的编码结束时,执行步骤513;确定当前CTU的编码未结束时,执行步骤514。When it is determined that the encoding of the current CTU is completed, step 513 is performed; when it is determined that the encoding of the current CTU is not ended, step 514 is performed.
步骤513,判断当前帧序列的编码是否结束;Step 513: Determine whether the encoding of the current frame sequence ends;
确定当前帧序列的编码结束时,执行步骤515;确定当前帧序列的编码未结束时,执行步骤516;When it is determined that the encoding of the current frame sequence ends, step 515 is performed; when it is determined that the encoding of the current frame sequence has not ended, step 516 is performed;
步骤514,开始对当前帧图像中的下一CTU进行编码处理; Step 514, start coding the next CTU in the current frame image;
这里,开始对当前帧图像中的下一CTU进行编码处理时,重复执行步骤 507-512。Here, when starting to encode the next CTU in the current frame image, steps 507-512 are repeatedly performed.
步骤515,结束处理; Step 515, end the process;
步骤516,开始对下一帧图像进行编码处理。In step 516, the encoding process of the next frame image is started.
图6为本发明实施例中数据处理装置的结构组成示意一,如图6所示,该装置包括:FIG. 6 is a first schematic diagram of the structural composition of a data processing device in an embodiment of the present invention. As shown in FIG. 6, the device includes:
获取单元601,设置为根据参考帧图像的输出结果,获取与所述参考帧图像对应的当前帧图像的运动矢量参数;The obtaining unit 601 is configured to obtain the motion vector parameters of the current frame image corresponding to the reference frame image according to the output result of the reference frame image;
确定单元602,设置为根据所述运动矢量参数,确定所述当前帧图像中目标区域对应的运动级别;The determining unit 602 is set to determine the motion level corresponding to the target area in the current frame image according to the motion vector parameter;
调整单元603,设置为当所述运动级别满足编码调整策略时,调整所述当前帧图像的编码参数。The adjusting unit 603 is configured to adjust the encoding parameters of the current frame image when the motion level meets the encoding adjustment strategy.
本发明实施例中,该装置可以是具有视频编码处理能力的装置,该装置还包括:In the embodiment of the present invention, the device may be a device with video encoding processing capabilities, and the device further includes:
划分单元604,设置为按照预设图像分割单位将所述当前帧图像划分为多个CTU,每个CTU的大小相同。The dividing unit 604 is configured to divide the current frame image into multiple CTUs according to a preset image division unit, and the size of each CTU is the same.
所述确定单元602还设置为将所述多个CTU中至少一个CTU确定为所述目标区域,或者,将所述当前帧图像对应的整体编码区域确定为所述目标区域。The determining unit 602 is further configured to determine at least one CTU of the plurality of CTUs as the target area, or determine the entire coding area corresponding to the current frame image as the target area.
本发明实施例中,所述确定单元602是设置为当所述目标区域是所述多个CTU中至少一个CTU对应的编码区域时,所述运动矢量参数包括所述至少一个CTU对应的运动矢量参数分量,根据所述至少一个CTU对应的所述运动矢量参数分量分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较所得到的第一比较结果,确定所述至少一个CTU对应的运动级别;或者,当所述目标区域是所述当前帧图像对应的整体编码区域时,所述运动矢量参数包括所述当 前帧图像的多个CTU中每个CTU对应的运动矢量参数分量,根据所述多个CTU中每个CTU对应的所述运动矢量参数分量分别与所述第一预设运动矢量参数和所述第二预设运动矢量参数进行=比较所得到的第二比较结果,将小于或等于所述第一预设运动矢量参数、且大于或等于所述第二预设运动矢量参数的目标运动矢量参数对应的CTU,确定为所述当前帧图像中满足编码调整策略的目标CTU,以及根据所述目标CTU在所述当前帧图像中所有CTU的占比与预设占比进行比较所得到的第三比较结果,确定所述当前帧图像中目标区域对应的运动级别。In the embodiment of the present invention, the determining unit 602 is set to when the target region is a coding region corresponding to at least one CTU among the plurality of CTUs, the motion vector parameter includes a motion vector corresponding to the at least one CTU Parameter component, determining the at least one CTU according to a first comparison result obtained by comparing the motion vector parameter component corresponding to the at least one CTU with a first preset motion vector parameter and a second preset motion vector parameter respectively Corresponding motion level; or, when the target area is the overall coding area corresponding to the current frame image, the motion vector parameter includes a motion vector parameter component corresponding to each CTU among the multiple CTUs of the current frame image , According to the second comparison result obtained by comparing the motion vector parameter component corresponding to each CTU in the plurality of CTUs with the first preset motion vector parameter and the second preset motion vector parameter=comparison , Determining the CTU corresponding to the target motion vector parameter that is less than or equal to the first preset motion vector parameter and greater than or equal to the second preset motion vector parameter as the one that satisfies the coding adjustment strategy in the current frame image The target CTU, and a third comparison result obtained by comparing the proportions of all CTUs in the current frame image of the target CTU with the preset ratio, to determine the motion level corresponding to the target area in the current frame image.
所述装置还包括比较单元605,所述比较单元605设置为将所述至少一个CTU对应的所述运动矢量参数分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第一比较结果,所述第一预设运动矢量参数大于所述第二预设运动矢量参数;或者,将所述多个CTU中每个CTU对应的所述运动矢量参数分量分别与所述第一预设运动矢量参数和所述第二预设运动矢量参数进行比较,得到第二比较结果;以及将所述目标CTU在所述当前帧图像中所有CTU的占比与预设占比进行比较,得到第三比较结果。The device further includes a comparison unit 605 configured to compare the motion vector parameters corresponding to the at least one CTU with the first preset motion vector parameter and the second preset motion vector parameter, respectively, to obtain A first comparison result, the first preset motion vector parameter is greater than the second preset motion vector parameter; or, the motion vector parameter components corresponding to each CTU of the plurality of CTUs are respectively compared with the first Comparing a preset motion vector parameter with the second preset motion vector parameter to obtain a second comparison result; and comparing the ratio of all CTUs of the target CTU in the current frame image to the preset ratio To get the third comparison result.
这里,所述运动级别满足编码调整策略,包括下列条件至少之一:Here, the motion level satisfies the coding adjustment strategy, including at least one of the following conditions:
所述运动级别对应的所述第一比较结果表征所述至少一个CTU对应的所述运动矢量参数分量小于或等于所述运动矢量参数分量、且大于或等于所述第二运动矢量参数;所述运动级别对应的所述第三比较结果表征所述目标CTU在所述当前帧图像中所有CTU的占比大于所述预设占比;以及所述运动级别不满足所述编码调整策略的时间达到预设时间。The first comparison result corresponding to the motion level characterizes that the motion vector parameter component corresponding to the at least one CTU is less than or equal to the motion vector parameter component and greater than or equal to the second motion vector parameter; The third comparison result corresponding to the motion level indicates that the ratio of all CTUs of the target CTU in the current frame image is greater than the preset ratio; and the time when the motion level does not meet the coding adjustment strategy is reached Preset time.
本发明实施例中,所述调整单元603是设置为通过以下方式至少之一调整所述当前帧图像的编码参数:增大所述当前帧图像对应的第一编码比特数、减 小所述当前帧图像对应的量化参数QP值、增大所述当前帧图像中目标CTU对应的第二编码比特数、以及减小所述目标CTU对应的QP值。In the embodiment of the present invention, the adjusting unit 603 is set to adjust the encoding parameter of the current frame image by at least one of the following ways: increasing the number of first encoding bits corresponding to the current frame image, and decreasing the current QP value of the quantization parameter corresponding to the frame image, increasing the number of second encoded bits corresponding to the target CTU in the current frame image, and decreasing the QP value corresponding to the target CTU.
本发明实施例中,所述调整单元603在减小所述当前帧图像对应的量化参数QP值时,还设置为根据为所述当前帧图像分配的目标编码比特数和所述当前帧图像中CTU的个数,增大所述当前帧图像的多个CTU中每个CTU对应的所述第二编码比特数;根据所述第二编码比特数,减小所述当前帧图像对应的所述QP值。In the embodiment of the present invention, when reducing the QP value of the quantization parameter corresponding to the current frame image, the adjustment unit 603 is further set according to the number of target encoding bits allocated to the current frame image and the current frame image. The number of CTUs increases the number of second encoded bits corresponding to each CTU among the multiple CTUs of the current frame image; according to the number of second encoded bits, decreases the number of second encoded bits corresponding to the current frame image QP value.
需要说明的是:上述实施例提供的数据处理装置在对当前帧图像的编码参数进行调整时,仅以上述各程序模块的划分进行举例说明,实际应用中,可以根据需要而将上述处理分配由不同的程序模块完成,即将数据处理装置的内部结构划分成不同的程序模块,以完成以上描述的全部或者部分处理。另外,上述实施例提供的数据处理装置与上述数据处理方法实施例属于同一构思,其实现过程详见方法实施例,这里不再赘述。It should be noted that when adjusting the encoding parameters of the current frame image, the data processing device provided in the above embodiment is only exemplified by the division of each program module. In practical applications, the above processing can be allocated as needed Different program modules are completed, that is, the internal structure of the data processing device is divided into different program modules to complete all or part of the processing described above. In addition, the data processing apparatus provided in the foregoing embodiment and the foregoing data processing method embodiment belong to the same concept, and the implementation process thereof is described in detail in the method embodiment, and will not be repeated here.
图7为本发明实施例中数据处理装置的结构组成示意图二,如图7所示,数据处理装置700可以是移动电话、计算机、数字广播终端、信息收发设备、游戏控制台、平板设备、个人数字助理、信息推送服务器、内容服务器等。图7所示的数据处理装置700包括:至少一个处理器701、存储器702、至少一个网络接口704和用户接口703。数据处理装置700中的每个组件通过总线系统705耦合在一起。可理解,总线系统705用于实现这些组件之间的连接通信。总线系统705除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图7中将每种总线都标为总线系统705。FIG. 7 is a second schematic diagram of the structure of the data processing device in the embodiment of the present invention. As shown in FIG. 7, the data processing device 700 may be a mobile phone, a computer, a digital broadcasting terminal, an information transceiving device, a game console, a tablet device, or an individual. Digital assistant, information push server, content server, etc. The data processing apparatus 700 shown in FIG. 7 includes: at least one processor 701, a memory 702, at least one network interface 704, and a user interface 703. Each component in the data processing apparatus 700 is coupled together through a bus system 705. It can be understood that the bus system 705 is used to implement connection and communication between these components. In addition to the data bus, the bus system 705 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, each type of bus is marked as the bus system 705 in FIG. 7.
其中,用户接口703可以包括显示器、键盘、鼠标、轨迹球、点击轮、按键、按钮、触感板或者触摸屏等。The user interface 703 may include a display, a keyboard, a mouse, a trackball, a click wheel, buttons, buttons, a touch panel, or a touch screen.
可以理解,存储器702可以是易失性存储器或非易失性存储器,也可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read Only Memory,ROM)、可编程只读存储器(Programmable Read-Only Memory,PROM)、可擦除可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM)、电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、磁性随机存取存储器(ferromagnetic random access memory,FRAM)、快闪存储器(Flash Memory)、磁表面存储器、光盘、或只读光盘(Compact Disc Read-Only Memory,CD-ROM);磁表面存储器可以是磁盘存储器或磁带存储器。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static Random Access Memory,SRAM)、同步静态随机存取存储器(Synchronous Static Random Access Memory,SSRAM)、动态随机存取存储器(Dynamic Random Access Memory,DRAM)、同步动态随机存取存储器(Synchronous Dynamic Random Access Memory,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate Synchronous Dynamic Random Access Memory,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced Synchronous Dynamic Random Access Memory,ESDRAM)、同步连接动态随机存取存储器(SyncLink Dynamic Random Access Memory,SLDRAM)、直接内存总线随机存取存储器(Direct Rambus Random Access Memory,DRRAM)。本发明实施例描述的存储器702旨在包括但不限于这些和任意其它适合类型的存储器。It can be understood that the memory 702 may be a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memory. Among them, the non-volatile memory can be read-only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory , EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Ferromagnetic Random Access Memory (FRAM), Flash Memory (Flash Memory), Magnetic Surface Memory , Compact disc, or read-only compact disc (Compact Disc Read-Only Memory, CD-ROM); the magnetic surface memory can be a disk storage or a tape storage. The volatile memory may be a random access memory (Random Access Memory, RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as Static Random Access Memory (Static Random Access Memory, SRAM), Synchronous Static Random Access Memory (Synchronous Static Random Access Memory, SSRAM), Dynamic Random Access Memory (Dynamic Random Access Memory, DRAM), Synchronous Dynamic Random Access Memory (Synchronous Dynamic Random Access Memory, SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (Double Data Rate Synchronous Dynamic Random Access Memory, DDRSDRAM), enhanced Synchronous dynamic random access memory (Enhanced Synchronous Dynamic Random Access Memory, ESDRAM), synchronous link dynamic random access memory (SyncLink Dynamic Random Access Memory, SLDRAM), direct memory bus random access memory (Direct Rambus Random Access Memory, DRRAM ). The memory 702 described in this embodiment of the present invention is intended to include, but is not limited to, these and any other suitable types of memory.
本发明实施例中的存储器702设置为存储各种类型的数据以支持数据处理装置700的操作。这些数据的示例包括:用于在数据处理装置700上操作的任 何计算机程序,如操作系统7021和应用程序7022;音乐数据;动漫数据;图书信息;视频等。其中,操作系统7021包含各种系统程序,例如框架层、核心库层、驱动层等,用于实现各种基础业务以及处理基于硬件的任务。应用程序7022可以包含各种应用程序,例如媒体播放器(Media Player)、浏览器(Browser)等,用于实现各种应用业务。实现本发明实施例方法的程序可以包含在应用程序7022中。The memory 702 in the embodiment of the present invention is configured to store various types of data to support the operation of the data processing apparatus 700. Examples of these data include: any computer program for operating on the data processing device 700, such as an operating system 7021 and an application program 7022; music data; animation data; book information; video, etc. Among them, the operating system 7021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks. The application program 7022 may include various application programs, such as a media player (Media Player), a browser (Browser), etc., for implementing various application services. The program for implementing the method of the embodiment of the present invention may be included in the application program 7022.
上述本发明实施例揭示的方法可以应用于处理器701中,或者由处理器701实现。处理器701可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的每个步骤可以通过处理器701中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器701可以是通用处理器、数字信号处理器(DSP,Digital Signal Processor),或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。处理器701可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本发明实施例所公开的方法的步骤,可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于存储介质中,该存储介质位于存储器702,处理器701读取存储器702中的信息,结合其硬件完成前述方法的步骤。The method disclosed in the foregoing embodiment of the present invention may be applied to the processor 701, or implemented by the processor 701. The processor 701 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware in the processor 701 or instructions in the form of software. The foregoing processor 701 may be a general-purpose processor, a digital signal processor (DSP, Digital Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and the like. The processor 701 may implement or execute the disclosed methods, steps, and logical block diagrams in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present invention may be directly implemented and completed by a hardware decoding processor, or may be implemented and completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium. The storage medium is located in the memory 702. The processor 701 reads the information in the memory 702 and completes the steps of the foregoing method in combination with its hardware.
在示例性实施例中,数据处理装置700可以被一个或多个应用专用集成电路(Application Specific Integrated Circuit,ASIC)、DSP、可编程逻辑器件(Programmable Logic Device,PLD)、复杂可编程逻辑器件(Complex Programmable Logic Device,CPLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器(Micro Controller Unit,MCU)、微处理器(Microprocessor)、或其他电子元件实现,用于执行前述方法。In an exemplary embodiment, the data processing apparatus 700 may be composed of one or more application specific integrated circuits (Application Specific Integrated Circuit (ASIC), DSP, programmable logic device (Programmable Logic Device, PLD), complex programmable logic device ( Complex Programmable Logic Device (CPLD), Field-Programmable Gate Array (FPGA), general-purpose processor, controller, microcontroller (Micro Controller), microprocessor (Microprocessor), or other Electronic components are implemented to perform the aforementioned method.
所述处理器701运行所述计算机程序时,执行:根据参考帧图像的输出结果,获取与所述参考帧图像对应的当前帧图像的运动矢量参数;根据所述运动矢量参数,确定所述当前帧图像中目标区域对应的运动级别;当所述运动级别满足编码调整策略时,调整所述当前帧图像的编码参数。When the processor 701 runs the computer program, it executes: acquiring the motion vector parameters of the current frame image corresponding to the reference frame image according to the output result of the reference frame image; determining the current according to the motion vector parameters The motion level corresponding to the target area in the frame image; when the motion level meets the coding adjustment strategy, adjust the coding parameters of the current frame image.
所述处理器701运行所述计算机程序时,还执行:按照预设图像分割单位将所述当前帧图像划分为多个编码树单元CTU;将所述多个CTU中至少一个CTU对应的编码区域确定为所述目标区域,或者,将所述当前帧图像对应的整体编码区域确定为所述目标区域。When the processor 701 runs the computer program, it also executes: dividing the current frame image into a plurality of coding tree unit CTUs according to a preset image division unit; dividing the coding region corresponding to at least one CTU among the plurality of CTUs It is determined to be the target area, or the entire coding area corresponding to the current frame image is determined to be the target area.
所述处理器701运行所述计算机程序时,还执行:当所述目标区域是所述多个CTU中至少一个CTU对应的编码区域时,所述运动矢量参数包括所述至少一个CTU对应的运动矢量参数分量,将所述至少一个CTU对应的所述运动矢量参数分量分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第一比较结果,所述第一预设运动矢量参数大于所述第二预设运动矢量参数;根据所述第一比较结果,确定所述至少一个CTU对应的运动级别;当所述目标区域是所述当前帧图像对应的整体编码区域时,所述运动矢量参数包括所述当前帧图像的多个CTU中每个CTU对应的运动矢量参数分量,将所述多个CTU中每个CTU对应的所述运动矢量参数分量分别与所述第一预设运动矢量参数和所述第二预设运动矢量参数进行比较,得到第二比较结果;根据第二比较结果,将小于或等于所述第一预设运动矢量参数、且大于或等于所述第二预设运动矢量参数的目标运动矢量参数对应的CTU,确定为所述当前帧图像中满足编码调整策略的目标CTU;将所述目标CTU在所述当前帧图像中所有CTU的占比与预设占比进行比较,得到第三比较结果;根据第三比较结果,确定所述当前帧图像中目标区域对应的运动级别。When the processor 701 runs the computer program, it also executes: when the target area is an encoding area corresponding to at least one CTU of the plurality of CTUs, the motion vector parameter includes motion corresponding to the at least one CTU Vector parameter component, comparing the motion vector parameter component corresponding to the at least one CTU with a first preset motion vector parameter and a second preset motion vector parameter respectively to obtain a first comparison result, the first preset The motion vector parameter is greater than the second preset motion vector parameter; according to the first comparison result, the motion level corresponding to the at least one CTU is determined; when the target area is the overall coding area corresponding to the current frame image , The motion vector parameter includes a motion vector parameter component corresponding to each CTU among multiple CTUs of the current frame image, and the motion vector parameter component corresponding to each CTU among the multiple CTUs is A preset motion vector parameter is compared with the second preset motion vector parameter to obtain a second comparison result; according to the second comparison result, the first preset motion vector parameter is less than or equal to and greater than or equal to The CTU corresponding to the target motion vector parameter of the second preset motion vector parameter is determined as the target CTU in the current frame image that satisfies the coding adjustment strategy; the ratio of the target CTU to all CTUs in the current frame image Comparing with the preset ratio to obtain a third comparison result; according to the third comparison result, determining the motion level corresponding to the target area in the current frame image.
所述运动级别满足编码调整策略,包括下列条件至少之一:The exercise level satisfies the coding adjustment strategy, including at least one of the following conditions:
所述运动级别对应的所述第一比较结果表征所述至少一个CTU对应的所述运动矢量参数分量小于或等于所述运动矢量参数分量、且大于或等于所述第二运动矢量参数;所述运动级别对应的所述第三比较结果表征所述目标CTU在所述当前帧图像中所有CTU的占比大于所述预设占比;以及所述运动级别不满足所述编码调整策略的时间达到预设时间。The first comparison result corresponding to the motion level characterizes that the motion vector parameter component corresponding to the at least one CTU is less than or equal to the motion vector parameter component and greater than or equal to the second motion vector parameter; The third comparison result corresponding to the motion level indicates that the ratio of all CTUs of the target CTU in the current frame image is greater than the preset ratio; and the time when the motion level does not meet the coding adjustment strategy is reached Preset time.
所述处理器701运行所述计算机程序时,还执行以下至少之一:增大所述当前帧图像对应的第一编码比特数、减小所述当前帧图像对应的量化参数QP值、增大所述当前帧图像中目标CTU对应的第二编码比特数、以及减小所述目标CTU对应的QP值。When the processor 701 runs the computer program, it also executes at least one of the following: increasing the number of first encoded bits corresponding to the current frame image, decreasing the quantization parameter QP value corresponding to the current frame image, increasing The number of second encoded bits corresponding to the target CTU in the current frame image, and reducing the QP value corresponding to the target CTU.
所述处理器701运行所述计算机程序时,还执行:根据为所述当前帧图像分配的目标编码比特数和所述当前帧图像中CTU的个数,增大所述当前帧图像的多个CTU中每个CTU对应的所述第二编码比特数;根据所述第二编码比特数,减小所述当前帧图像对应的所述QP值。When the processor 701 runs the computer program, it also executes: according to the number of target encoding bits allocated to the current frame image and the number of CTUs in the current frame image, increase the number of the current frame image The second coded bit number corresponding to each CTU in the CTU; according to the second coded bit number, the QP value corresponding to the current frame image is reduced.
在示例性实施例中,本发明实施例还提供了一种计算机可读存储介质,例如包括计算机程序的存储器702,上述计算机程序可由数据处理装置700的处理器701执行,以完成前述方法所述步骤。计算机可读存储介质可以是FRAM、ROM、PROM、EPROM、EEPROM、Flash Memory、磁表面存储器、光盘、或CD-ROM等存储器;也可以是包括上述存储器之一或任意组合的各种设备,如移动电话、计算机、平板设备、个人数字助理等。In an exemplary embodiment, an embodiment of the present invention further provides a computer-readable storage medium, for example, a memory 702 including a computer program, which can be executed by the processor 701 of the data processing apparatus 700 to complete the foregoing method step. The computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disk, or CD-ROM; it may also be various devices including one or any combination of the above memories, such as Mobile phones, computers, tablet devices, personal digital assistants, etc.
一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器运行时,执行:根据参考帧图像的输出结果,获取与所述参考帧图像对应的当前帧图像的运动矢量参数;根据所述运动矢量参数,确定所述当前帧图像中 目标区域对应的运动级别;当所述运动级别满足编码调整策略时,调整所述当前帧图像的编码参数。A computer-readable storage medium on which a computer program is stored, which when executed by a processor, executes: according to the output result of a reference frame image, obtains motion vector parameters of a current frame image corresponding to the reference frame image Determine the motion level corresponding to the target area in the current frame image according to the motion vector parameters; when the motion level meets the coding adjustment strategy, adjust the coding parameters of the current frame image.
该计算机程序被处理器运行时,还执行:按照预设图像分割单位将所述当前帧图像划分为多个编码树单元CTU;将所述多个CTU中至少一个CTU对应的编码区域确定为所述目标区域,或者,将所述当前帧图像对应的整体编码区域确定为所述目标区域。When the computer program is executed by the processor, it also executes: dividing the current frame image into a plurality of coding tree unit CTUs according to a preset image division unit; determining the coding region corresponding to at least one CTU among the plurality of CTUs as the The target area, or the entire coding area corresponding to the current frame image is determined as the target area.
该计算机程序被处理器运行时,还执行:当所述目标区域是所述多个CTU中至少一个CTU对应的编码区域时,所述运动矢量参数包括所述至少一个CTU对应的运动矢量参数分量,将所述至少一个CTU对应的所述运动矢量参数分量分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第一比较结果,所述第一预设运动矢量参数大于所述第二预设运动矢量参数;根据所述第一比较结果,确定所述至少一个CTU对应的运动级别;当所述目标区域是所述当前帧图像对应的整体编码区域时,所述运动矢量参数包括所述当前帧图像的多个CTU中每个CTU对应的运动矢量参数分量,将所述多个CTU中每个CTU对应的所述运动矢量参数分量分别与所述第一预设运动矢量参数和所述第二预设运动矢量参数进行比较,得到第二比较结果;根据第二比较结果,将小于或等于所述第一预设运动矢量参数、且大于或等于所述第二预设运动矢量参数的目标运动矢量参数对应的CTU,确定为所述当前帧图像中满足编码调整策略的目标CTU;将所述目标CTU在所述当前帧图像中所有CTU的占比与预设占比进行比较,得到第三比较结果;根据第三比较结果,确定所述当前帧图像中目标区域对应的运动级别。When the computer program is executed by the processor, it also executes: when the target area is an encoding area corresponding to at least one CTU of the plurality of CTUs, the motion vector parameter includes a motion vector parameter component corresponding to the at least one CTU , Comparing the motion vector parameter components corresponding to the at least one CTU with the first preset motion vector parameter and the second preset motion vector parameter respectively to obtain a first comparison result, the first preset motion vector parameter Greater than the second preset motion vector parameter; determining the motion level corresponding to the at least one CTU according to the first comparison result; when the target area is the overall coding area corresponding to the current frame image, the The motion vector parameter includes a motion vector parameter component corresponding to each CTU of the plurality of CTUs of the current frame image, and the motion vector parameter component corresponding to each CTU of the plurality of CTUs is respectively compared with the first preset The motion vector parameter is compared with the second preset motion vector parameter to obtain a second comparison result; according to the second comparison result, the first preset motion vector parameter is less than or equal to and greater than or equal to the second The CTU corresponding to the target motion vector parameter of the preset motion vector parameter is determined to be the target CTU that satisfies the encoding adjustment strategy in the current frame image; the ratio of the target CTU to all CTUs in the current frame image and the preset The proportions are compared to obtain a third comparison result; according to the third comparison result, the motion level corresponding to the target area in the current frame image is determined.
所述运动级别满足编码调整策略,包括下列条件至少之一:The exercise level satisfies the coding adjustment strategy, including at least one of the following conditions:
所述运动级别对应的所述第一比较结果表征所述至少一个CTU对应的所述 运动矢量参数分量小于或等于所述运动矢量参数分量、且大于或等于所述第二运动矢量参数;所述运动级别对应的所述第三比较结果表征所述目标CTU在所述当前帧图像中所有CTU的占比大于所述预设占比;以及所述运动级别不满足所述编码调整策略的时间达到预设时间。The first comparison result corresponding to the motion level characterizes that the motion vector parameter component corresponding to the at least one CTU is less than or equal to the motion vector parameter component and greater than or equal to the second motion vector parameter; The third comparison result corresponding to the motion level indicates that the ratio of all CTUs of the target CTU in the current frame image is greater than the preset ratio; and the time when the motion level does not meet the coding adjustment strategy is reached Preset time.
该计算机程序被处理器运行时,还执行以下至少之一:增大所述当前帧图像对应的第一编码比特数、减小所述当前帧图像对应的量化参数QP值、增大所述当前帧图像中目标CTU对应的第二编码比特数、以及减小所述目标CTU对应的QP值。When the computer program is executed by the processor, it also executes at least one of the following: increasing the number of first encoded bits corresponding to the current frame image, decreasing the quantization parameter QP value corresponding to the current frame image, and increasing the current The number of second encoded bits corresponding to the target CTU in the frame image, and reducing the QP value corresponding to the target CTU.
该计算机程序被处理器运行时,还执行:根据为所述当前帧图像分配的目标编码比特数和所述当前帧图像中CTU的个数,增大所述当前帧图像的多个CTU中每个CTU对应的所述第二编码比特数;根据所述第二编码比特数,减小所述当前帧图像对应的所述QP值。When the computer program is run by the processor, it also executes: increasing each of the multiple CTUs of the current frame image according to the number of target coded bits allocated for the current frame image and the number of CTUs in the current frame image The number of second encoded bits corresponding to each CTU; according to the number of second encoded bits, decrease the QP value corresponding to the current frame image.

Claims (12)

  1. 一种数据处理方法,包括:A data processing method, including:
    根据参考帧图像的输出结果,获取与所述参考帧图像对应的当前帧图像的运动矢量参数;Acquiring the motion vector parameters of the current frame image corresponding to the reference frame image according to the output result of the reference frame image;
    根据所述运动矢量参数,确定所述当前帧图像中目标区域对应的运动级别;Determine the motion level corresponding to the target area in the current frame image according to the motion vector parameter;
    当所述运动级别满足编码调整策略时,调整所述当前帧图像的编码参数。When the motion level satisfies the coding adjustment strategy, the coding parameters of the current frame image are adjusted.
  2. 根据权利要求1所述的方法,其中,在所述根据所述运动矢量参数,确定所述当前帧图像中目标区域对应的运动级别之前,所述方法还包括:The method according to claim 1, wherein before the determining the motion level corresponding to the target region in the current frame image according to the motion vector parameter, the method further comprises:
    按照预设图像分割单位将所述当前帧图像划分为多个编码树单元CTU;Divide the current frame image into multiple coding tree units CTU according to a preset image division unit;
    将所述多个CTU中至少一个CTU对应的编码区域确定为所述目标区域,或者,将所述当前帧图像对应的整体编码区域确定为所述目标区域。The coding region corresponding to at least one CTU of the plurality of CTUs is determined as the target region, or the entire coding region corresponding to the current frame image is determined as the target region.
  3. 根据权利要求2所述的方法,其中,当所述目标区域是所述多个CTU中至少一个CTU对应的编码区域时,所述运动矢量参数包括所述至少一个CTU对应的运动矢量参数分量;The method according to claim 2, wherein, when the target region is a coding region corresponding to at least one CTU of the plurality of CTUs, the motion vector parameter includes a motion vector parameter component corresponding to the at least one CTU;
    所述根据所述运动矢量参数,确定所述当前帧图像中目标区域对应的运动级别,包括:The determining the motion level corresponding to the target area in the current frame image according to the motion vector parameter includes:
    将所述至少一个CTU对应的所述运动矢量参数分量分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第一比较结果,所述第一预设运动矢量参数大于所述第二预设运动矢量参数;Comparing the motion vector parameter components corresponding to the at least one CTU with the first preset motion vector parameter and the second preset motion vector parameter respectively to obtain a first comparison result, the first preset motion vector parameter is greater than The second preset motion vector parameter;
    根据所述第一比较结果,确定所述至少一个CTU对应的运动级别。According to the first comparison result, the exercise level corresponding to the at least one CTU is determined.
  4. 根据权利要求2或3所述的方法,其中,当所述目标区域是所述当前帧图像对应的整体编码区域时,所述运动矢量参数包括所述当前帧图像的多个CTU中每个CTU对应的运动矢量参数分量;The method according to claim 2 or 3, wherein when the target area is an overall coding area corresponding to the current frame image, the motion vector parameter includes each CTU of the plurality of CTUs of the current frame image Corresponding motion vector parameter components;
    所述根据所述运动矢量参数,确定所述当前帧图像中目标区域对应的运动级别,包括:The determining the motion level corresponding to the target area in the current frame image according to the motion vector parameter includes:
    将所述多个CTU中每个CTU对应的所述运动矢量参数分量分别与所述第一预设运动矢量参数和所述第二预设运动矢量参数进行比较,得到第二比较结果;Comparing the motion vector parameter component corresponding to each CTU of the plurality of CTUs with the first preset motion vector parameter and the second preset motion vector parameter, respectively, to obtain a second comparison result;
    根据所述第二比较结果,将小于或等于所述第一预设运动矢量参数、且大于或等于所述第二预设运动矢量参数的运动矢量参数分量对应的CTU,确定为所述当前帧图像中满足编码调整策略的目标CTU;According to the second comparison result, determine the CTU corresponding to the motion vector parameter component that is less than or equal to the first preset motion vector parameter and greater than or equal to the second preset motion vector parameter as the current frame The target CTU in the image that meets the coding adjustment strategy;
    将所述目标CTU在所述当前帧图像中所有CTU的占比与预设占比进行比较,得到第三比较结果;Comparing the ratio of all CTUs of the target CTU in the current frame image with a preset ratio to obtain a third comparison result;
    根据所述第三比较结果,确定所述当前帧图像中目标区域对应的运动级别。According to the third comparison result, the motion level corresponding to the target area in the current frame image is determined.
  5. 根据权利要求3或4所述的方法,其中,所述运动级别满足编码调整策略,包括下列条件至少之一:The method according to claim 3 or 4, wherein the motion level satisfies the coding adjustment strategy, including at least one of the following conditions:
    所述运动级别对应的所述第一比较结果表征所述至少一个CTU对应的所述运动矢量参数分量小于或等于所述第一预设运动矢量参数、且大于或等于所述第二预设运动矢量参数;The first comparison result corresponding to the motion level characterizes that the motion vector parameter component corresponding to the at least one CTU is less than or equal to the first preset motion vector parameter and greater than or equal to the second preset motion Vector parameter
    所述运动级别对应的所述第三比较结果表征所述目标CTU在所述当前帧图像中所有CTU的占比大于所述预设占比;以及The third comparison result corresponding to the motion level indicates that the target CTU accounts for more than all the CTUs in the current frame image than the preset ratio; and
    所述运动级别不满足所述编码调整策略的时间达到预设时间。The time when the exercise level does not satisfy the coding adjustment strategy reaches a preset time.
  6. 根据权利要求1或4所述的方法,其中,所述调整所述当前帧图像的编码参数,包括以下至少之一:The method according to claim 1 or 4, wherein the adjusting the encoding parameters of the current frame image includes at least one of the following:
    增大所述当前帧图像对应的第一编码比特数;Increase the number of first encoded bits corresponding to the current frame image;
    减小所述当前帧图像对应的量化参数QP值;增大所述当前帧图像中目标 CTU对应的第二编码比特数;以及Reducing the QP value of the quantization parameter corresponding to the current frame image; increasing the number of second encoded bits corresponding to the target CTU in the current frame image; and
    减小所述目标CTU对应的QP值。Reduce the QP value corresponding to the target CTU.
  7. 根据权利要求6所述的方法,其中,在减小所述当前帧图像对应的QP值之前,所述方法还包括:The method according to claim 6, wherein before reducing the QP value corresponding to the current frame image, the method further comprises:
    根据为所述当前帧图像分配的目标编码比特数和所述当前帧图像中CTU的个数,增大所述当前帧图像的多个CTU中每个CTU对应的所述第二编码比特数;Increase the number of second encoded bits corresponding to each CTU among the multiple CTUs of the current frame image according to the number of target coded bits allocated for the current frame image and the number of CTUs in the current frame image;
    根据所述第二编码比特数,减小所述当前帧图像对应的所述QP值。According to the second coded bit number, the QP value corresponding to the current frame image is reduced.
  8. 一种数据处理装置,包括:A data processing device, including:
    获取单元,设置为根据参考帧图像的输出结果,获取与所述参考帧图像对应的当前帧图像的运动矢量参数;An obtaining unit configured to obtain the motion vector parameters of the current frame image corresponding to the reference frame image according to the output result of the reference frame image;
    确定单元,设置为根据所述运动矢量参数,确定所述当前帧图像中目标区域对应的运动级别;A determining unit, configured to determine the motion level corresponding to the target area in the current frame image according to the motion vector parameter;
    调整单元,设置为当所述运动级别满足编码调整策略时,调整所述当前帧图像的编码参数。The adjusting unit is configured to adjust the encoding parameters of the current frame image when the motion level meets the encoding adjustment strategy.
  9. 根据权利要求8所述的装置,还包括划分单元,设置为按照预设图像分割单位将所述当前帧图像划分为多个编码树单元CTU;The apparatus according to claim 8, further comprising a division unit configured to divide the current frame image into a plurality of coding tree units CTU according to a preset image division unit;
    所述确定单元还设置为将所述多个CTU中至少一个CTU确定为所述目标区域,或者,将所述当前帧图像对应的整体编码区域确定为所述目标区域。The determining unit is further configured to determine at least one CTU of the plurality of CTUs as the target area, or determine the entire coding area corresponding to the current frame image as the target area.
  10. 根据权利要求9所述的装置,其中,The device according to claim 9, wherein
    所述确定单元是设置为当所述目标区域是所述多个CTU中至少一个CTU对应的编码区域时,所述运动矢量参数包括所述至少一个CTU对应的运动矢量参数分量,根据所述至少一个CTU对应的所述运动矢量参数分量分别与第一预 设运动矢量参数和第二预设运动矢量参数进行比较所得到的第一比较结果,确定所述至少一个CTU对应的运动级别;或者,当所述目标区域是所述当前帧图像对应的整体编码区域时,所述运动矢量参数包括所述当前帧图像的多个CTU中每个CTU对应的运动矢量参数分量,根据所述多个CTU中每个CTU对应的所述运动矢量参数分量分别与所述第一预设运动矢量参数和所述第二预设运动矢量参数进行比较所得到的第二比较结果,将小于或等于所述第一预设运动矢量参数、且大于或等于所述第二预设运动矢量参数的运动矢量参数分量对应的CTU,确定为所述当前帧图像中满足编码调整策略的目标CTU,以及根据所述目标CTU在所述当前帧图像中所有CTU的占比与预设占比进行比较所得到的第三比较结果,确定所述当前帧图像中目标区域对应的运动级别;The determining unit is configured to, when the target region is a coding region corresponding to at least one CTU of the plurality of CTUs, the motion vector parameter includes a motion vector parameter component corresponding to the at least one CTU, according to the at least one A first comparison result obtained by comparing the motion vector parameter components corresponding to one CTU with the first preset motion vector parameter and the second preset motion vector parameter to determine the motion level corresponding to the at least one CTU; or, When the target area is the overall coding area corresponding to the current frame image, the motion vector parameter includes a motion vector parameter component corresponding to each CTU among multiple CTUs of the current frame image, according to the multiple CTUs A second comparison result obtained by comparing the motion vector parameter components corresponding to each CTU in the first preset motion vector parameter and the second preset motion vector parameter respectively will be less than or equal to the first A preset motion vector parameter and a CTU corresponding to a motion vector parameter component greater than or equal to the second preset motion vector parameter, determined as the target CTU in the current frame image that satisfies the encoding adjustment strategy, and according to the target A third comparison result obtained by comparing the proportion of all CTUs in the current frame image with the preset proportion in the current frame image to determine the motion level corresponding to the target area in the current frame image;
    所述装置还包括比较单元,所述比较单元设置为将所述至少一个CTU对应的所述运动矢量参数分别与第一预设运动矢量参数和第二预设运动矢量参数进行比较,得到第一比较结果,所述第一预设运动矢量参数大于所述第二预设运动矢量参数;或者,将所述多个CTU中每个CTU对应的所述运动矢量参数分量分别与所述第一预设运动矢量参数和所述第二预设运动矢量参数进行比较,得到第二比较结果,以及将所述目标CTU在所述当前帧图像中所有CTU的占比与预设占比进行比较,得到第三比较结果。The device further includes a comparison unit configured to compare the motion vector parameters corresponding to the at least one CTU with a first preset motion vector parameter and a second preset motion vector parameter, respectively, to obtain a first A comparison result, the first preset motion vector parameter is greater than the second preset motion vector parameter; or, the motion vector parameter component corresponding to each CTU of the plurality of CTUs is respectively Set the motion vector parameter and the second preset motion vector parameter for comparison to obtain a second comparison result, and compare the ratio of all CTUs of the target CTU in the current frame image with the preset ratio to obtain The third comparison result.
  11. 一种数据处理装置,包括:存储器和处理器;A data processing device, including: a memory and a processor;
    其中,所述存储器,设置为存储能够在所述处理器上运行的计算机程序;Wherein, the memory is configured to store a computer program that can run on the processor;
    所述处理器,设置为运行所述计算机程序时,执行权利要求1至7任一项所述方法的步骤。The processor is configured to execute the steps of the method according to any one of claims 1 to 7 when running the computer program.
  12. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行如权利要求1-7中任一项所述方法的步骤。A computer-readable storage medium storing computer-executable instructions for performing the steps of the method according to any one of claims 1-7.
PCT/CN2019/126075 2018-12-17 2019-12-17 Data processing method and apparatus, and storage medium WO2020125649A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811541533.5 2018-12-17
CN201811541533.5A CN111327895B (en) 2018-12-17 2018-12-17 Data processing method and device

Publications (1)

Publication Number Publication Date
WO2020125649A1 true WO2020125649A1 (en) 2020-06-25

Family

ID=71100672

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/126075 WO2020125649A1 (en) 2018-12-17 2019-12-17 Data processing method and apparatus, and storage medium

Country Status (2)

Country Link
CN (1) CN111327895B (en)
WO (1) WO2020125649A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0603878A2 (en) * 1992-12-25 1994-06-29 Mitsubishi Denki Kabushiki Kaisha Coding system and method
CN101090502A (en) * 2006-06-13 2007-12-19 中兴通讯股份有限公司 Controllable quick motion valuation algorithm for prediction quality
CN101207810A (en) * 2006-12-21 2008-06-25 联想(北京)有限公司 Method and apparatus for fast mode selecting of H264 video coding
CN101815218A (en) * 2010-04-02 2010-08-25 北京工业大学 Method for coding quick movement estimation video based on macro block characteristics
CN103079068A (en) * 2013-01-14 2013-05-01 天津大学 Interframe mode judging method based on relevance between motion intensity and space domain
CN104837015A (en) * 2015-04-30 2015-08-12 电子科技大学 Low-delay coding adaptive QP Offset adjusting method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0603878A2 (en) * 1992-12-25 1994-06-29 Mitsubishi Denki Kabushiki Kaisha Coding system and method
CN101090502A (en) * 2006-06-13 2007-12-19 中兴通讯股份有限公司 Controllable quick motion valuation algorithm for prediction quality
CN101207810A (en) * 2006-12-21 2008-06-25 联想(北京)有限公司 Method and apparatus for fast mode selecting of H264 video coding
CN101815218A (en) * 2010-04-02 2010-08-25 北京工业大学 Method for coding quick movement estimation video based on macro block characteristics
CN103079068A (en) * 2013-01-14 2013-05-01 天津大学 Interframe mode judging method based on relevance between motion intensity and space domain
CN104837015A (en) * 2015-04-30 2015-08-12 电子科技大学 Low-delay coding adaptive QP Offset adjusting method

Also Published As

Publication number Publication date
CN111327895A (en) 2020-06-23
CN111327895B (en) 2022-05-24

Similar Documents

Publication Publication Date Title
US10841583B2 (en) Coding unit depth determining method and apparatus
CN109788316B (en) Code rate control method and device, video transcoding method and device, computer equipment and storage medium
JP7012747B2 (en) Video frame coding method, terminal, and storage medium
US20060062481A1 (en) Apparatuses, computer program product and method for bit rate control of digital image encoder
WO2021129007A1 (en) Method and device for determining video bitrate, computer apparatus, and storage medium
WO2021093060A1 (en) Video encoding method, system, and apparatus
WO2017140230A1 (en) Method and device for adjusting target code rate
WO2021238605A1 (en) Video coding method and apparatus, video decoding method and apparatus, electronic device, and storage medium
WO2022001559A1 (en) Video encoding method and apparatus, electronic device and machine-readable storage medium
WO2019076344A1 (en) Reference block selection method and apparatus for encoding unit, electronic device, and storage medium
CN112655212B (en) Video coding optimization method and device and computer storage medium
WO2022213809A1 (en) Video coding method, apparatus and device, and storage medium
TWI703857B (en) Video transcoding method and device, computer storage medium and electronic device
US20230045884A1 (en) Rio-based video coding method and deivice
US20130107960A1 (en) Scene dependent motion search range adaptation
WO2020186763A1 (en) Image component prediction method, encoder, decoder and storage medium
WO2020125649A1 (en) Data processing method and apparatus, and storage medium
CN103327329A (en) Method and system for quantitative adjustment of image quality jump
TWI637627B (en) Systems, methods and computer program products for integrated post-processing and pre-processing in video transcoding
WO2018205781A1 (en) Method for use in achieving motion estimation and electronic device
CN103002284B (en) A kind of video coding-decoding method based on model of place adaptive updates
WO2022198465A1 (en) Coding method and apparatus
CN105872538A (en) Time-domain filtering method and time-domain filtering device
CN109561315B (en) Motion estimation method and device, electronic equipment and storage medium
WO2020107449A1 (en) Coding method, coder and computer 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: 19900860

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

Country of ref document: EP

Kind code of ref document: A1