WO2017140230A1 - Method and device for adjusting target code rate - Google Patents

Method and device for adjusting target code rate Download PDF

Info

Publication number
WO2017140230A1
WO2017140230A1 PCT/CN2017/073227 CN2017073227W WO2017140230A1 WO 2017140230 A1 WO2017140230 A1 WO 2017140230A1 CN 2017073227 W CN2017073227 W CN 2017073227W WO 2017140230 A1 WO2017140230 A1 WO 2017140230A1
Authority
WO
WIPO (PCT)
Prior art keywords
sub
images
image
code rate
encoded
Prior art date
Application number
PCT/CN2017/073227
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 WO2017140230A1 publication Critical patent/WO2017140230A1/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/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/513Processing of motion vectors
    • 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

Definitions

  • This document relates to, but is not limited to, the field of video coding technology, and relates to a target rate adjustment method and apparatus.
  • the selection of the target bit rate is an important link, which is directly related to the visual quality of the picture.
  • the target bit rate of the encoded code is usually controlled based on the network bandwidth to obtain a balance between visual quality and bandwidth usage.
  • the code rate controller sets the capacity feedback value of the hypothetical reference decoding buffer based on the network bandwidth, and is used for
  • the encoded target code rate is calculated and assigned to maintain a smooth video output stream as much as possible, and to provide a minimum distortion video image decoding visual quality at a minimum bit rate.
  • the related art selects the target code rate based on the capacity of the imaginary reference decoding buffer, there is a problem that the selected target code rate is not accurate enough.
  • the embodiment of the invention provides a method and a device for adjusting a target bit rate, which can improve the accuracy of the selected target bit rate.
  • An embodiment of the present invention provides a target rate adjustment method, where the target rate adjustment method includes:
  • adjusting a target code rate of the encoding according to the magnitude relationship between the fluctuation strength and the first preset threshold include:
  • the encoded target code rate is reduced.
  • the method before the step of adjusting the target code rate of the encoding according to the magnitude relationship between the fluctuation strength and the first preset threshold, the method further includes:
  • the encoded wave strength is updated to the calculated average.
  • the image frame to be encoded is divided into a plurality of first sub-images, and the plurality of first sub-images are classified according to motion vector values of each of the first sub-images, and each class is calculated.
  • the steps of the PSNR value of the first sub-image include:
  • a PSNR value for each type of first sub-image is calculated based on each of the mean square errors.
  • the method further includes:
  • the adjusted target code rate is corrected based on the current network bandwidth to be encoded using the corrected target code rate.
  • the step of modifying the adjusted target bit rate based on the current network bandwidth includes:
  • the network bandwidth is used as the corrected target code rate.
  • the embodiment of the present invention provides a target rate adjustment apparatus, where the target rate adjustment apparatus includes:
  • a first calculating module configured to divide the image frame to be encoded into a plurality of first sub-images, and classify the plurality of first sub-images according to motion vector values of each of the first sub-images, and calculate each Peak signal to noise ratio PSNR value of the first sub-image of the class;
  • a second calculating module configured to calculate an average value ⁇ of PSNR values of each type of first sub-image, and calculate a standard deviation ⁇ of PSNR values of each type of first sub-image, and correct the ratio of ⁇ to ⁇ by using a preset correction parameter After the wave strength as the code;
  • the adjusting module is configured to adjust the target code rate of the encoding according to the magnitude relationship between the fluctuation strength and the first preset threshold, wherein the target code rate of the encoding is adjusted according to the magnitude relationship between the fluctuation strength and the first preset threshold include:
  • the encoded target code rate is reduced.
  • the target rate adjustment device further includes:
  • a recording module configured to record the currently calculated fluctuation intensity, and calculate an average value of the recorded fluctuation strength when the recorded fluctuation intensity reaches a second preset threshold
  • An update module is arranged to update the encoded wave strength to the calculated average.
  • the first computing module includes:
  • a classifying unit configured to divide the image frame to be encoded into a plurality of first sub-images, and calculate a motion vector value of each of the first sub-images relative to the adjacent image frames of the image frame to be encoded, according to each Sorting the plurality of first sub-images by a vector value interval in which the motion vector value of the first sub-image is located;
  • a calculating unit configured to divide the reconstructed image frame of the image frame to be encoded into a plurality of second sub-images in the same division manner as the image frame to be encoded, and calculate each of the first sub-images and a mean square error between the second sub-images corresponding to each of the first sub-images; and calculating a PSNR value for each of the first sub-images based on each of the mean square errors.
  • the target rate adjustment apparatus further includes a correction module configured to correct the adjusted target code rate based on the current network bandwidth to perform encoding using the corrected target code rate.
  • the modifying module corrects the adjusted target code rate based on the current network bandwidth by determining whether the current network bandwidth is greater than the adjusted target code rate; and in the current network. When the bandwidth is less than the adjusted target code rate, the network bandwidth is used as the corrected target code rate.
  • the image frame to be encoded is divided into a plurality of first sub-images, and the plurality of the first sub-images are classified according to the motion vector values of the first sub-images, and the first type is calculated.
  • the peak signal-to-noise ratio PSNR value of the sub-image, and then the ratio of the standard deviation ⁇ and the average value ⁇ of the PSNR values of the first sub-images are corrected by the preset correction parameters as the encoded fluctuation intensity, and the obtained fluctuation intensity includes Reconstruction distortion of image frames and features of motion compensation.
  • the embodiment of the invention when the fluctuation strength is increased in the encoding process, based on the time domain correlation of the adjacent image frames, the next image frame to be encoded of the image frame to be encoded needs more bits for description (ie, encoding). Therefore, compared with the related art, the target code rate is selected by the imaginary value, and the technical solution of the embodiment of the present invention can accurately reflect the bit required for the coding by adjusting the target code rate of the coded by the fluctuation intensity in real time, thereby improving the selected target. The accuracy of the bit rate.
  • the embodiment of the invention further provides a computer readable storage medium, wherein the computer readable storage medium stores computer executable instructions, and the computer executable instructions are implemented to implement a target rate adjustment method.
  • FIG. 1 is a schematic flowchart of a target bit rate adjustment method according to Embodiment 1 of the present invention
  • FIG. 2 is a schematic diagram of motion compensation in a first embodiment of a target code rate adjustment method according to Embodiment 1 of the present invention
  • FIG. 3 is a real measurement diagram of target rate adjustment in the first embodiment of the code rate adjustment method according to the first embodiment of the present invention
  • FIG. 4 is a schematic diagram showing a refinement flow of calculating a PSNR value of each type of first sub-image in FIG. 1;
  • FIG. 5 is a motion vector distribution diagram of a first sub-image of a target bit rate adjustment method according to Embodiment 3 of the present invention.
  • FIG. 6 is a schematic diagram of functional blocks of a target bit rate adjustment apparatus according to Embodiment 5 of the present invention.
  • FIG. 7 is a schematic diagram of a refinement function module of the first computing module in FIG. 6.
  • An embodiment of the present invention provides a target rate adjustment method.
  • the target rate adjustment method includes:
  • Step S10 dividing the image frame to be encoded into a plurality of first sub-images, and classifying the plurality of first sub-images according to motion vector values of each of the first sub-images, and calculating the first sub-category of each Peak signal to noise ratio PSNR value of the image;
  • the target rate adjustment method proposed in this embodiment can be applied to video coding control of streaming media, for example, when encoding, by motion compensation vector calculation, and combining the distortion statistics of the reconstructed image frame to perform coding of the target code rate. Select to accurately select the appropriate target bit rate to reduce the occupation of network bandwidth while ensuring video quality.
  • the image frame to be encoded is divided into a plurality of first sub-images in a square shape. It can be understood by those skilled in the art that in other embodiments, the shape of the first sub-image may be selected according to actual needs. For example, the image frame may be divided into a plurality of first sub-images that are rectangular.
  • the size of the first sub-image may be set to 64*64.
  • the image After dividing the image frame into a plurality of first sub-images, calculating motion vector values of each of the first sub-images, and pairing the plurality of the first ones according to motion vector values of each of the first sub-images One son
  • the image is classified, that is, a plurality of the first sub-images are classified according to a vector value interval in which the motion vector value of each of the first sub-images is located.
  • the motion vector value can directly reflect the fluctuation strength of the image.
  • the image content of the moving image adjacent to the image frame has time domain correlation.
  • motion compensation is performed for each of the first sub-images, a matching block of the first sub-image is searched for in an adjacent image frame of the image frame, and a motion vector of the matching block of the first sub-image is recorded.
  • MV i,j ( ⁇ x, ⁇ y)
  • a first sub-image is selected in the image frame at time t, a minimum distortion search is performed in the adjacent image frame at time t-1, a matching block with minimum distortion is obtained, and the first sub-child is calculated.
  • the vector distance of the matching block of the image and the minimum distortion, as shown in Fig. 2, MV ( ⁇ x, ⁇ y), thereby calculating the motion vector value of the selected first sub-image
  • the adjacent image frame of the currently selected image frame refers to the previous image frame in which the image frame is selected on the frame sequence.
  • PSNR Peak Signal to Noise Ratio
  • Step S20 calculating an average value ⁇ of PSNR values of each type of first sub-image, and calculating a standard deviation ⁇ of PSNR values of each type of first sub-image, and correcting the ratio of ⁇ to ⁇ by using a preset correction parameter as a coded Fluctuation intensity
  • the average value of the PSNR values of each type of first sub-image Standard deviation of PSNR values for each type of first sub-image
  • each vector value interval corresponds to a k value
  • P k is a PSNR value of each type of first sub-image.
  • the ratio of ⁇ to ⁇ is corrected using the preset correction parameter ⁇ as the encoded fluctuation intensity V, that is, the fluctuation intensity.
  • the ⁇ value is an empirical parameter for normalizing the ratio of ⁇ to ⁇ to increase the processing speed. For example, the ⁇ value is set to 100 in this embodiment.
  • a maximum k value k max may also be set, and a first sub-image with a motion vector value greater than k max is divided into k max intervals, where k max is an empirical parameter, for example, this embodiment will k max is set to 9.
  • step S30 the target code rate of the encoding is adjusted according to the magnitude relationship between the fluctuation strength and the first preset threshold.
  • the target code rate of the encoding is adjusted according to the magnitude relationship between the fluctuation strength and the first preset threshold.
  • the encoded target code rate is reduced.
  • the encoded target code rate is reduced.
  • the first preset threshold may be set according to actual needs. For example, in this embodiment, the first preset threshold is set to 5.
  • the step value TBR C of the target rate adjustment is preset. As a basis for each target rate adjustment.
  • FIG. 3 a measured view of the target code rate adjustment of the embodiment is provided.
  • the target code rate is adjusted according to the change of the fluctuation intensity in real time. It is possible that the low bit occupancy occupies the visual decoding quality of the video image with minimal distortion.
  • the encoded target code rate is not adjusted.
  • a first preset threshold interval may be further set, when the fluctuation strength V is greater than a maximum value in the first preset threshold interval, increasing a target code rate of the encoding; when the fluctuation strength is When the V is located in the first preset threshold interval, the encoded target code rate is not adjusted; when the fluctuation strength V is smaller than the minimum value in the first preset threshold interval, the encoded target code rate is reduced.
  • the first preset interval is set to [4, 5].
  • the target rate adjustment method proposed in this embodiment divides an image frame to be encoded into a plurality of first a sub-image, and classifying the plurality of first sub-images according to motion vector values of each of the first sub-images, calculating a peak signal-to-noise ratio PSNR value of each type of first sub-image, and then first The ratio of the standard deviation ⁇ of the PSNR value of the sub-image and the average value ⁇ is corrected by the preset correction parameter as the encoded fluctuation intensity, and the obtained fluctuation intensity includes the reconstruction distortion of the image frame and the characteristics of the motion compensation.
  • the target code rate is selected by the imaginary value.
  • the technical solution of the embodiment of the present invention can accurately reflect the bit required for the coding by adjusting the target code rate of the coded in real time by the fluctuation strength, and improve the selected target bit rate. Accuracy.
  • the target rate adjustment method further includes:
  • the encoded wave strength is updated to the calculated average.
  • the image content of the moving image adjacent to the image frame has time domain correlation, the image content of the adjacent consecutive multiple image frames tends to be substantially the same, and correspondingly, the variation of the fluctuation intensity of the encoding in a short time is often negligible.
  • the fluctuation strength of the encoding is calculated once per frame, the target rate is adjusted once in a long time, and there is a waste of processing resources. Therefore, in this embodiment, a window having a size of ⁇ (the aforementioned second preset threshold, specifically, can be set as needed) is set, and the average fluctuation intensity of the image frame in the window is counted every ⁇ frame to determine whether to perform The adjustment of the target bit rate.
  • is a positive number greater than 0, for example, the value range can be set to [1, 30].
  • the currently calculated fluctuation intensity when the currently calculated fluctuation strength is recorded, the currently calculated fluctuation intensity may also be smoothed based on the last calculated fluctuation intensity to eliminate the influence of noise during the encoding process.
  • the current The calculated fluctuation intensity is recorded as: a ⁇ V t-1 +b ⁇ V t ;
  • V t-1 represents the last calculated fluctuation intensity
  • V t represents the currently calculated fluctuation intensity
  • the processing resource consumption is reduced on the basis of ensuring the accuracy of selecting the target code rate.
  • step S10 includes:
  • Step S101 dividing an image frame to be encoded into a plurality of first sub-images, and calculating a motion vector value of each of the first sub-images of the image frame to be encoded relative to adjacent image frames, according to each of the Sorting the plurality of first sub-images by a vector value interval in which a motion vector value of a sub-image is located;
  • a continuous video is composed of a series of image frames.
  • the image frame to be encoded is divided into a plurality of first sub-images in a square shape.
  • the shape of the first sub-image may be selected according to actual needs.
  • the image frame may be divided into a plurality of first sub-images that are rectangular.
  • the size of the first sub-image may be set to 64*64.
  • a sub-image is classified, that is, a plurality of the first sub-images are classified according to a vector value interval in which the motion vector value of each of the first sub-images is located.
  • the motion vector value can directly reflect the fluctuation strength of the image.
  • the image content of the moving image adjacent to the image frame has a time domain correlation.
  • motion compensation is performed for each of the first sub-images, a matching block of the first sub-image is searched for in an adjacent image frame of the image frame, and a motion vector of the matching block of the first sub-image is recorded.
  • MV i,j ( ⁇ x, ⁇ y)
  • a first sub-image is selected in the image frame at time t, and a minimum distortion search is performed in the adjacent image frame at time t-1 to obtain a minimum distortion matching block, and the first first is calculated.
  • the calculated motion vector distribution of each of the first sub-images of the image frame is as shown in FIG.
  • Step S102 dividing the reconstructed image frame of the image frame to be encoded into a plurality of second sub-images according to the same division manner as the image frame to be encoded, and calculating each of the first sub-images and each a mean square error between the second sub-images corresponding to the first sub-image;
  • the next frame of coding is encoded based on the reconstructed frame of the current frame.
  • the reconstructed image frame of the image frame to be encoded is divided into a plurality of second sub-images in the same division manner as the image frame to be encoded, and each of the first sub-images is calculated.
  • a mean square error between the second sub-images corresponding to each of the first sub-images wherein a mean square error between the first sub-image and its corresponding second sub-image Represents the standard deviation of the first sub-image, Indicates the standard deviation of the second sub-image.
  • Step S103 calculating a PSNR value of each class first sub-image based on each of the mean square errors.
  • the average distortion D k of the first sub-image of each class is first counted as ⁇ D i,j
  • k is an integer, and each of the aforementioned vector value intervals corresponds to a k value.
  • the target rate adjustment method further includes:
  • the adjusted target code rate is corrected based on the current network bandwidth to be encoded using the corrected target code rate.
  • the network bandwidth in this embodiment refers to the network bandwidth available for encoding video transmission, and those skilled in the art may understand that the network bandwidth is dynamically changed, and the network bandwidth is also local resources.
  • the problem of preemption therefore, in order to ensure the smoothness of the transmission of the encoded video, in this embodiment, the currently available network bandwidth is obtained, and the adjusted target bit rate is corrected based on the obtained network bandwidth, and the method is adopted. The corrected target bit rate is encoded.
  • the correcting the adjusted target bit rate based on the current network bandwidth includes:
  • the network bandwidth is used as the corrected target code rate.
  • the network bandwidth is smaller than the adjusted target code rate, if the adjusted target bit rate is used for encoding, the encoded video data cannot be smoothly transmitted to the target terminal, resulting in playback. Problems such as Caton affect the user's visual experience. Therefore, in this embodiment, when the current network bandwidth is less than the adjusted target code rate, the network bandwidth is used as the corrected target code rate to ensure that the encoded video data can be smoothly transmitted to Target terminal.
  • the target rate adjustment apparatus includes:
  • the first calculating module 10 is configured to divide the image frame to be encoded into a plurality of first sub-images, and classify the plurality of first sub-images according to motion vector values of each of the first sub-images, and calculate Peak signal to noise ratio PSNR value of the first sub-image of each class;
  • the target rate adjustment apparatus proposed in this embodiment may be applied to video coding control of a streaming media, for example, at the time of encoding, by performing motion compensation vector calculation, and combining the distortion statistics of the reconstructed image frame to perform coding of the target code rate. Select to accurately select the appropriate target bit rate to ensure video quality The amount of time reduces the occupation of network bandwidth.
  • the first calculation module 10 divides the image frame to be encoded into a plurality of first sub-images in a square shape. It can be understood by those skilled in the art that in other embodiments, the shape of the first sub-image may be selected according to actual needs. For example, the first calculation module 10 may divide the image frame into a plurality of rectangles. Sub image.
  • the size of the first sub-image may be set to 64*64.
  • the first calculation module 10 calculates a motion vector value of each of the first sub-images, and performs motion vector value pairs for each of the first sub-images.
  • the plurality of first sub-images are classified, that is, a plurality of the first sub-images are classified according to a vector value interval in which the motion vector value of each of the first sub-images is located. Among them, the motion vector value can directly reflect the fluctuation strength of the image.
  • the first calculating module 10 performs motion compensation on each of the first sub-images, searches for matching blocks of the first sub-image in adjacent image frames of the image frame, and records the first sub-image.
  • Matching block motion vector MV i,j ( ⁇ x, ⁇ y), Is a motion vector value, where ⁇ x represents the displacement of the first sub-image in the x-axis direction, and ⁇ y represents the displacement of the first sub-image in the y-axis direction.
  • a first sub-image is selected in the image frame at time t, and a minimum distortion search is performed in the adjacent image frame at time t-1 to obtain a minimum distortion matching block, and the first first is calculated.
  • the vector distance of the sub-image and the minimum distortion matching block, as shown in Fig. 2, MV ( ⁇ x, ⁇ y), thereby calculating the motion vector value of the selected first sub-image
  • the adjacent image frame of the currently selected image frame refers to the previous image frame on the frame sequence in which the image frame is selected.
  • the first calculation module 10 calculates a Peak Signal to Noise Ratio (PSNR) value of the first sub-image of each class.
  • PSNR Peak Signal to Noise Ratio
  • the second calculating module 20 is configured to calculate an average value ⁇ of the PSNR values of the first sub-images of each class, and calculate a standard deviation ⁇ of the PSNR values of the first sub-images of each class, and preset a ratio of ⁇ to ⁇ Correct the fluctuation intensity of the code as the code after correction;
  • the average value of the PSNR values of the first sub-images of each class Standard deviation of PSNR values for the first sub-image of each class
  • each vector value interval corresponds to a k value
  • P k is a PSNR value of each type of first sub-image.
  • the second calculation module 20 After calculating the ⁇ value and the ⁇ value of each type of sub-image, the second calculation module 20 corrects the ratio of ⁇ to ⁇ using the preset correction parameter ⁇ as the encoded fluctuation intensity V, that is, the fluctuation intensity.
  • the ⁇ value is an empirical parameter for normalizing the ratio of ⁇ to ⁇ to increase the processing speed. For example, the ⁇ value is set to 100 in this embodiment.
  • a maximum k value k max may also be set, and a first sub-image with a motion vector value greater than k max is divided into k max intervals, where k max is an empirical parameter, for example, this embodiment will k max is set to 9.
  • the adjusting module 30 is configured to adjust the target code rate of the encoding according to the magnitude relationship between the fluctuation strength and the first preset threshold, where the target code rate of the encoding is adjusted according to the magnitude relationship between the fluctuation strength and the first preset threshold. : increasing the target code rate of the encoding when the fluctuation strength is greater than the first preset threshold;
  • the encoded target code rate is reduced.
  • the adjustment module 30 determines whether the fluctuation intensity V is greater than a first preset threshold, and if the fluctuation strength V is greater than the first A predetermined threshold increases the encoded target rate; otherwise, if the fluctuation intensity V is less than or equal to the first predetermined threshold, the encoded target code rate is decreased.
  • the first preset threshold is set according to actual needs. For example, in this embodiment, the first preset threshold is set to 5.
  • the step value TBR C of the target rate adjustment is preset. The benchmark for each target rate adjustment.
  • FIG. 3 a measured view of the target code rate adjustment of the embodiment is provided.
  • the target code rate is adjusted according to the change of the fluctuation intensity in real time. It is possible that the low bit occupancy occupies the visual decoding quality of the video image with minimal distortion.
  • the encoded target code rate is not adjusted.
  • a first preset threshold interval may be further set, when the fluctuation strength V is greater than a maximum value in the first preset threshold interval, increasing a target code rate of the encoding; when the fluctuation strength is When the V is located in the first preset threshold interval, the encoded target code rate is not adjusted; when the fluctuation strength V is smaller than the minimum value in the first preset threshold interval, the encoded target code rate is reduced.
  • the first preset interval is set to [4, 5].
  • the target rate adjustment apparatus of the present embodiment divides an image frame to be encoded into a plurality of first sub-images, and performs a plurality of the first sub-images according to motion vector values of each of the first sub-images. Classification, calculating the peak signal-to-noise ratio PSNR value of each type of first sub-image, and then comparing the standard deviation ⁇ of the PSNR value of each type of the first sub-image with the average value ⁇ as the encoded fluctuation intensity by using the preset correction parameter
  • the resulting wave strength includes the reconstruction distortion of the image frame and the characteristics of motion compensation.
  • the target code rate is selected by the imaginary value.
  • the technical solution of the embodiment of the present invention can accurately reflect the bit required for the coding by adjusting the target code rate of the coded in real time by the fluctuation strength, and improve the selected target bit rate. Accuracy.
  • the target rate adjustment apparatus further includes:
  • a recording module configured to record the currently calculated fluctuation intensity, and calculate an average value of the recorded fluctuation strength when the recorded fluctuation intensity reaches a second preset threshold
  • An update module is arranged to update the encoded wave strength to the calculated average.
  • the recording module After completing the encoding of the image frame to be encoded and calculating the fluctuating intensity of the encoding, the recording module records the fluctuating intensity calculated at the time, and counts the calculated fluctuating intensity in the current window. Average fluctuation intensity of image frames
  • the update module updates the encoded wave strength to the calculated average wave strength
  • t is an integer multiple of ⁇
  • t is used to indicate the position of the corresponding image frame in the sequence of frames.
  • the recording module when recording the currently calculated fluctuation strength, may further smooth the currently calculated fluctuation intensity based on the last calculated fluctuation intensity to eliminate the influence of noise in the encoding process, in this embodiment.
  • the recording module records the currently calculated fluctuation strength as: a ⁇ V t-1 +b ⁇ V t ;
  • V t-1 represents the last calculated fluctuation intensity
  • V t represents the currently calculated fluctuation intensity
  • the processing resource consumption is reduced on the basis of ensuring the accuracy of selecting the target code rate.
  • the first calculating module 10 includes:
  • the classification unit 101 is configured to divide the image frame to be encoded into a plurality of first sub-images, and calculate a motion vector value of each of the first sub-images of the image frame to be encoded relative to adjacent image frames, according to each Sorting the plurality of first sub-images by a vector value interval in which the motion vector value of the first sub-image is located;
  • a continuous video is composed of a series of image frames.
  • the classification unit 101 divides the image frame to be encoded into a plurality of first sub-images in a square shape. It can be understood by those skilled in the art that in other embodiments, the shape of the first sub-image may be selected according to actual needs.
  • the classification unit 101 may divide the image frame into a plurality of first sub-images that are rectangular. .
  • the size of the first sub-image may be set to 64*64.
  • the classifying unit 101 calculates a motion vector value of each of the first sub-images, and pairs the motion vector values of each of the first sub-images
  • the first sub-image is classified, that is, the plurality of first sub-images are classified according to a vector value interval in which the motion vector value of each of the first sub-images is located.
  • the motion vector value can directly reflect the fluctuation strength of the image.
  • the classifying unit 101 performs motion compensation on each of the first sub-images, searches for matching blocks of the first sub-image in adjacent image frames of the image frame, and records matching blocks of the first sub-image.
  • Motion vector MV i,j ( ⁇ x, ⁇ y), Is a motion vector value, where ⁇ x represents the displacement of the first sub-image in the x-axis direction, and ⁇ y represents the displacement of the first sub-image in the y-axis direction.
  • the calculated motion vector distribution of each first sub-image of the image frame is as shown in FIG.
  • the calculating unit 102 is configured to divide the reconstructed image frame of the image frame to be encoded into a plurality of second sub-images according to the same division manner as the image frame to be encoded, and calculate each of the first sub-images And a mean square error between the second sub-images corresponding to each of the first sub-images; and calculating a PSNR value of each of the first sub-images based on each of the mean square errors.
  • the next frame of coding is encoded based on the reconstructed frame of the current frame.
  • the calculating unit 102 divides the reconstructed image frame of the image frame to be encoded into a plurality of second sub-images according to the same division manner as the image frame to be encoded, and calculates each of the first a mean square error between a sub-image and a second sub-image corresponding to each of the first sub-images, wherein a mean square error between the first sub-image and its corresponding second sub-image Represents the standard deviation of the first sub-image, Indicates the standard deviation of the second sub-image.
  • the calculating unit 102 After calculating the mean square error between each of the first sub-images and the second sub-image corresponding to each of the first sub-images, the calculating unit 102 first counts the average distortion of the first sub-image of each class.
  • D k ⁇ D i,j
  • the computing unit 102 then calculates the PSNR value of each class first sub-image based on the average distortion of each class first sub-image, and the PSNR value of each class first sub-image.
  • bpp represents the number of bits when the pixel point gray value is expressed in binary, as in the 0 to 255 gray level representation, the value of bpp is 8.
  • the target rate adjustment apparatus further includes a correction module configured to correct the adjusted target code rate based on the current network bandwidth to adopt the corrected target.
  • the code rate is encoded.
  • the network bandwidth in this embodiment refers to the network bandwidth available for encoding video transmission, and those skilled in the art may understand that the network bandwidth is dynamically changed, and the network bandwidth is also local resources.
  • the correction module acquires the currently available network bandwidth, and corrects the adjusted target code rate based on the acquired network bandwidth. , encoding with the corrected target bit rate.
  • the modifying module corrects the adjusted target code rate based on the current network bandwidth by determining whether the current network bandwidth is greater than the adjusted target code rate; and in the current network. When the bandwidth is less than the adjusted target code rate, the network bandwidth is used as the corrected target code rate.
  • the correction module uses the network bandwidth as the corrected target code rate to ensure that the encoded video data can be Smooth transfer to the target terminal.
  • the embodiment of the invention further provides a computer readable storage medium, wherein the computer readable storage medium stores computer executable instructions, and the computer executable instructions are implemented to implement a target rate adjustment method.
  • each module/unit in the above embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, executing a program stored in the memory by a processor. / instruction to achieve its corresponding function.
  • This application is not limited to any specific combination of hardware and software.
  • the above technical solution can more accurately reflect the bits required for encoding, and improve the accuracy of the selected target bit rate.

Landscapes

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

Abstract

A method for adjusting a target code rate. The method for adjusting a target code rate comprises: dividing an image frame to be encoded into a plurality of first sub-images, classifying the plurality of first sub-images according to a motion vector value of each of the first sub-images, and calculating a peak signal-to-noise ratio (PSNR) value of each class of first sub-images; calculating an average value of the PSNR value of each class of first sub-images, calculating the standard deviation of the PSNR value of each class of first sub-images, and correcting the ratio of the average value to the standard deviation by using a pre-set correction parameter, and then taking the ratio as the fluctuation strength of the encoding; and adjusting a target code rate for encoding according to a magnitude relationship between the fluctuation strength and a first pre-set threshold value, wherein when the fluctuation strength is greater than the first pre-set threshold value, the target code rate for encoding is increased, and when the fluctuation strength is less than the first pre-set threshold value, the target code rate for encoding is reduced. The technical solution can improve the accuracy of selecting a target code rate.

Description

目标码率调整方法及装置Target rate adjustment method and device 技术领域Technical field
本文涉及但不限于视频编码技术领域,涉及一种目标码率调整方法及装置。This document relates to, but is not limited to, the field of video coding technology, and relates to a target rate adjustment method and apparatus.
背景技术Background technique
在视频编码的可变码率控制中,目标码率的选取是一个重要的环节,直接关系到画面视觉质量的好坏。相关技术中,通常基于网络带宽控制编码的目标码率,以获得视觉质量和带宽使用之间的平衡,具体的,码率控制器基于网络带宽设置假想参考解码缓冲区的容量反馈数值,用于计算和分配编码的目标码率,以尽可能地保持平稳的视频输出流,并在最小码率下提供最小失真的视频图像解码视觉质量。但是,由于相关技术基于假想参考解码缓冲区的容量进行编码的目标码率的选取,存在选取的目标码率不够准确的问题。In the variable rate control of video coding, the selection of the target bit rate is an important link, which is directly related to the visual quality of the picture. In the related art, the target bit rate of the encoded code is usually controlled based on the network bandwidth to obtain a balance between visual quality and bandwidth usage. Specifically, the code rate controller sets the capacity feedback value of the hypothetical reference decoding buffer based on the network bandwidth, and is used for The encoded target code rate is calculated and assigned to maintain a smooth video output stream as much as possible, and to provide a minimum distortion video image decoding visual quality at a minimum bit rate. However, since the related art selects the target code rate based on the capacity of the imaginary reference decoding buffer, there is a problem that the selected target code rate is not accurate enough.
发明内容Summary of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this document. This Summary is not intended to limit the scope of the claims.
本发明实施例提供一种目标码率调整方法及装置,可以提高选取的目标码率的准确度。The embodiment of the invention provides a method and a device for adjusting a target bit rate, which can improve the accuracy of the selected target bit rate.
本发明实施例提供一种目标码率调整方法,所述目标码率调整方法包括:An embodiment of the present invention provides a target rate adjustment method, where the target rate adjustment method includes:
将待编码的图像帧划分为多个第一子图像,并按照每个所述第一子图像的运动矢量值对所述多个第一子图像进行分类,计算每类第一子图像的峰值信噪比PSNR值;Dividing the image frame to be encoded into a plurality of first sub-images, and classifying the plurality of first sub-images according to motion vector values of each of the first sub-images, and calculating peak values of each of the first sub-images Signal to noise ratio PSNR value;
计算每类第一子图像的PSNR值的平均值μ,以及计算每类第一子图像的PSNR值的标准方差σ,对σ与μ的比值采用预设修正参数修正后作为编码的波动强度;Calculating an average value μ of PSNR values of each type of first sub-image, and calculating a standard deviation σ of PSNR values of each type of first sub-image, and correcting the ratio of σ to μ as a coded fluctuation intensity by using a preset correction parameter;
根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率,其中,所述根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率 包括:And adjusting a target code rate of the encoding according to the magnitude relationship between the fluctuation strength and the first preset threshold, wherein the adjusting the target code rate according to the magnitude relationship between the fluctuation strength and the first preset threshold include:
当所述波动强度大于第一预设阈值时,增大编码的目标码率;When the fluctuation strength is greater than the first preset threshold, increasing the encoded target code rate;
当所述波动强度小于第一预设阈值时,减小编码的目标码率。When the fluctuation strength is less than the first predetermined threshold, the encoded target code rate is reduced.
可选地,根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率的步骤之前,所述方法还包括:Optionally, before the step of adjusting the target code rate of the encoding according to the magnitude relationship between the fluctuation strength and the first preset threshold, the method further includes:
记录当前计算的波动强度,并在记录的波动强度的数量达到第二预设阈值时,计算记录的波动强度的平均值;Recording the currently calculated fluctuation intensity, and calculating an average value of the recorded fluctuation strength when the recorded fluctuation intensity reaches the second preset threshold;
将编码的所述波动强度更新为计算的所述平均值。The encoded wave strength is updated to the calculated average.
可选地,所述将待编码的图像帧划分为多个第一子图像,并按照每个所述第一子图像的运动矢量值对所述多个第一子图像进行分类,计算每类第一子图像的PSNR值的步骤包括:Optionally, the image frame to be encoded is divided into a plurality of first sub-images, and the plurality of first sub-images are classified according to motion vector values of each of the first sub-images, and each class is calculated. The steps of the PSNR value of the first sub-image include:
将待编码的图像帧划分为多个第一子图像,计算待编码的所述图像帧每个所述第一子图像相对于相邻图像帧的运动矢量值,按照每个所述第一子图像的运动矢量值所在的矢量值区间对所述多个第一子图像进行分类;Dividing the image frame to be encoded into a plurality of first sub-images, and calculating a motion vector value of each of the first sub-images of the image frame to be encoded relative to the adjacent image frames, according to each of the first sub- Sorting the plurality of first sub-images by a vector value interval in which a motion vector value of the image is located;
按照与待编码的所述图像帧相同的划分方式将待编码的所述图像帧的重构图像帧划分为多个第二子图像,计算每个所述第一子图像以及每个所述第一子图像对应的第二子图像之间的均方误差;Decomposing the reconstructed image frame of the image frame to be encoded into a plurality of second sub-images in the same division manner as the image frame to be encoded, and calculating each of the first sub-images and each of the first a mean square error between the second sub-images corresponding to a sub-image;
基于每个所述均方误差计算每类第一子图像的PSNR值。A PSNR value for each type of first sub-image is calculated based on each of the mean square errors.
可选地,根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率的步骤之后,所述方法还包括:Optionally, after the step of adjusting the target code rate of the encoding according to the magnitude relationship between the fluctuation strength and the first preset threshold, the method further includes:
基于当前的网络带宽对调整后的所述目标码率进行修正,以采用修正后的目标码率进行编码。The adjusted target code rate is corrected based on the current network bandwidth to be encoded using the corrected target code rate.
可选地,所述基于当前的网络带宽对调整后的所述目标码率进行修正的步骤包括:Optionally, the step of modifying the adjusted target bit rate based on the current network bandwidth includes:
判断当前的网络带宽是否大于调整后的所述目标码率;Determining whether the current network bandwidth is greater than the adjusted target code rate;
在当前的网络带宽小于调整后的所述目标码率时,将所述网络带宽作为修正后的所述目标码率。 When the current network bandwidth is less than the adjusted target code rate, the network bandwidth is used as the corrected target code rate.
本发明实施例`还提供了一种目标码率调整装置,所述目标码率调整装置包括:The embodiment of the present invention provides a target rate adjustment apparatus, where the target rate adjustment apparatus includes:
第一计算模块,设置为将待编码的图像帧划分为多个第一子图像,并按照每个所述第一子图像的运动矢量值对所述多个第一子图像进行分类,计算每类第一子图像的峰值信噪比PSNR值;a first calculating module, configured to divide the image frame to be encoded into a plurality of first sub-images, and classify the plurality of first sub-images according to motion vector values of each of the first sub-images, and calculate each Peak signal to noise ratio PSNR value of the first sub-image of the class;
第二计算模块,设置为计算每类第一子图像的PSNR值的平均值μ,以及计算每类第一子图像的PSNR值的标准方差σ,对σ与μ的比值采用预设修正参数修正后作为编码的波动强度;a second calculating module, configured to calculate an average value μ of PSNR values of each type of first sub-image, and calculate a standard deviation σ of PSNR values of each type of first sub-image, and correct the ratio of σ to μ by using a preset correction parameter After the wave strength as the code;
调整模块,设置为根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率,其中,所述根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率包括:The adjusting module is configured to adjust the target code rate of the encoding according to the magnitude relationship between the fluctuation strength and the first preset threshold, wherein the target code rate of the encoding is adjusted according to the magnitude relationship between the fluctuation strength and the first preset threshold include:
当所述波动强度大于第一预设阈值时,增大编码的目标码率;When the fluctuation strength is greater than the first preset threshold, increasing the encoded target code rate;
当所述波动强度小于第一预设阈值时,减小编码的目标码率。When the fluctuation strength is less than the first predetermined threshold, the encoded target code rate is reduced.
可选地,所述目标码率调整装置还包括:Optionally, the target rate adjustment device further includes:
记录模块,设置为记录当前计算的波动强度,并在记录的波动强度的数量达到第二预设阈值时,计算记录的波动强度的平均值;a recording module configured to record the currently calculated fluctuation intensity, and calculate an average value of the recorded fluctuation strength when the recorded fluctuation intensity reaches a second preset threshold;
更新模块,设置为将编码的所述波动强度更新为计算的所述平均值。An update module is arranged to update the encoded wave strength to the calculated average.
可选地,所述第一计算模块包括:Optionally, the first computing module includes:
分类单元,设置为将待编码的图像帧划分为多个第一子图像,计算待编码的所述图像帧每个所述第一子图像相对于相邻图像帧的运动矢量值,按照每个所述第一子图像的运动矢量值所在的矢量值区间对所述多个第一子图像进行分类;a classifying unit configured to divide the image frame to be encoded into a plurality of first sub-images, and calculate a motion vector value of each of the first sub-images relative to the adjacent image frames of the image frame to be encoded, according to each Sorting the plurality of first sub-images by a vector value interval in which the motion vector value of the first sub-image is located;
计算单元,设置为按照与待编码的所述图像帧相同的划分方式将待编码的所述图像帧的重构图像帧划分为多个第二子图像,计算每个所述第一子图像以及每个所述第一子图像对应的第二子图像之间的均方误差;以及基于每个所述均方误差计算每个各类第一子图像的PSNR值。 a calculating unit, configured to divide the reconstructed image frame of the image frame to be encoded into a plurality of second sub-images in the same division manner as the image frame to be encoded, and calculate each of the first sub-images and a mean square error between the second sub-images corresponding to each of the first sub-images; and calculating a PSNR value for each of the first sub-images based on each of the mean square errors.
可选地,所述目标码率调整装置还包括修正模块,设置为基于当前的网络带宽对调整后的所述目标码率进行修正,以采用修正后的目标码率进行编码。Optionally, the target rate adjustment apparatus further includes a correction module configured to correct the adjusted target code rate based on the current network bandwidth to perform encoding using the corrected target code rate.
可选地,所述修正模块通过如下方式实现基于当前的网络带宽对调整后的所述目标码率进行修正:判断当前的网络带宽是否大于调整后的所述目标码率;以及在当前的网络带宽小于调整后的所述目标码率时,将所述网络带宽作为修正后的所述目标码率。Optionally, the modifying module corrects the adjusted target code rate based on the current network bandwidth by determining whether the current network bandwidth is greater than the adjusted target code rate; and in the current network. When the bandwidth is less than the adjusted target code rate, the network bandwidth is used as the corrected target code rate.
本发明实施例通过将待编码的图像帧划分为多个第一子图像,并按照各所述第一子图像的运动矢量值对多个所述第一子图像进行分类,计算各类第一子图像的峰值信噪比PSNR值,再对各类第一子图像的PSNR值的标准方差σ以及平均值μ的比值采用预设修正参数修正后作为编码的波动强度,得到的波动强度包括了图像帧的重构失真以及运动补偿的特征。上述技术方案当波动强度在编码过程中增大时,基于邻近图像帧的时域相关性,所述待编码的图像帧的下一待编码的图像帧需要更多的比特进行描述(即编码),因此,相较于相关技术通过假想值选取目标码率,本发明实施例的技术方案通过波动强度实时进行编码的目标码率的调整,能够更准确的反映编码需要的比特,提高选取的目标码率的准确度。本发明实施例还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机可执行指令,所述计算机可执行指令被执行时实现目标码率调整方法。In the embodiment of the present invention, the image frame to be encoded is divided into a plurality of first sub-images, and the plurality of the first sub-images are classified according to the motion vector values of the first sub-images, and the first type is calculated. The peak signal-to-noise ratio PSNR value of the sub-image, and then the ratio of the standard deviation σ and the average value μ of the PSNR values of the first sub-images are corrected by the preset correction parameters as the encoded fluctuation intensity, and the obtained fluctuation intensity includes Reconstruction distortion of image frames and features of motion compensation. The above technical solution, when the fluctuation strength is increased in the encoding process, based on the time domain correlation of the adjacent image frames, the next image frame to be encoded of the image frame to be encoded needs more bits for description (ie, encoding). Therefore, compared with the related art, the target code rate is selected by the imaginary value, and the technical solution of the embodiment of the present invention can accurately reflect the bit required for the coding by adjusting the target code rate of the coded by the fluctuation intensity in real time, thereby improving the selected target. The accuracy of the bit rate. The embodiment of the invention further provides a computer readable storage medium, wherein the computer readable storage medium stores computer executable instructions, and the computer executable instructions are implemented to implement a target rate adjustment method.
在阅读并理解了附图和详细描述后,可以明白其它方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
附图说明DRAWINGS
图1为本发明实施例一的目标码率调整方法的流程示意图;1 is a schematic flowchart of a target bit rate adjustment method according to Embodiment 1 of the present invention;
图2为本发明实施例一的目标码率调整方法第一实施例中的运动补偿示意图;2 is a schematic diagram of motion compensation in a first embodiment of a target code rate adjustment method according to Embodiment 1 of the present invention;
图3为本发明目实施例一的标码率调整方法第一实施例中的目标码率调整的实测图;3 is a real measurement diagram of target rate adjustment in the first embodiment of the code rate adjustment method according to the first embodiment of the present invention;
图4为图1中计算每类第一子图像的PSNR值的细化流程示意图; 4 is a schematic diagram showing a refinement flow of calculating a PSNR value of each type of first sub-image in FIG. 1;
图5为本发明实施例三的目标码率调整方法的第一子图像的运动矢量分布图;5 is a motion vector distribution diagram of a first sub-image of a target bit rate adjustment method according to Embodiment 3 of the present invention;
图6为本发明实施例五的目标码率调整装置的功能模块示意图;6 is a schematic diagram of functional blocks of a target bit rate adjustment apparatus according to Embodiment 5 of the present invention;
图7为图6中第一计算模块的细化功能模块示意图。FIG. 7 is a schematic diagram of a refinement function module of the first computing module in FIG. 6.
具体实施方式detailed description
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
实施例一 Embodiment 1
本发明实施例提供一种目标码率调整方法,参照图1,所述目标码率调整方法包括:An embodiment of the present invention provides a target rate adjustment method. Referring to FIG. 1, the target rate adjustment method includes:
步骤S10,将待编码的图像帧划分为多个第一子图像,并按照每个所述第一子图像的运动矢量值对所述多个第一子图像进行分类,计算每类第一子图像的峰值信噪比PSNR值;Step S10, dividing the image frame to be encoded into a plurality of first sub-images, and classifying the plurality of first sub-images according to motion vector values of each of the first sub-images, and calculating the first sub-category of each Peak signal to noise ratio PSNR value of the image;
本实施例提出的目标码率调整方法可以应用于流媒体的视频编码控制中,例如,在编码时,通过运动补偿矢量计算,并结合重构图像帧的失真统计来进行编码的目标码率的选取,以准确的选取合适的目标码率,在保证视频质量的同时降低对网络带宽的占用。The target rate adjustment method proposed in this embodiment can be applied to video coding control of streaming media, for example, when encoding, by motion compensation vector calculation, and combining the distortion statistics of the reconstructed image frame to perform coding of the target code rate. Select to accurately select the appropriate target bit rate to reduce the occupation of network bandwidth while ensuring video quality.
由于一个连续的视频是由一系列的图像帧组成的,为了方便计算,在本实施例中,将待编码的图像帧划分为多个呈正方形的第一子图像。本领域技术人员可以理解的是,在其他实施例中,可以按实际需要选择划分第一子图像的形状,例如,可以将所述图像帧划分为多个呈长方形的第一子图像。Since one continuous video is composed of a series of image frames, in order to facilitate calculation, in the present embodiment, the image frame to be encoded is divided into a plurality of first sub-images in a square shape. It can be understood by those skilled in the art that in other embodiments, the shape of the first sub-image may be selected according to actual needs. For example, the image frame may be divided into a plurality of first sub-images that are rectangular.
在本实施例中,划分得到第一子图像的个数取决于第一子图像的大小,以所述图像帧的像素点宽为W、像素点高为H,第一子图像的大小为n*n为例,划分得到第一子图像的个数N=WB×HB,其中
Figure PCTCN2017073227-appb-000001
为上取整运算。可选地,为了提升处理的速度,可以将第一子图像的大小设为64*64。
In this embodiment, the number of the first sub-images divided depends on the size of the first sub-image, wherein the pixel width of the image frame is W, the pixel height is H, and the size of the first sub-image is n. *n is an example, and the number of the first sub-images is divided into N=WB×HB, wherein
Figure PCTCN2017073227-appb-000001
Round up the operation. Optionally, in order to increase the speed of the processing, the size of the first sub-image may be set to 64*64.
在将所述图像帧划分为多个第一子图像之后,计算每个所述第一子图像的运动矢量值,并按照每个所述第一子图像的运动矢量值对多个所述第一子 图像进行分类,即按照每个所述第一子图像的运动矢量值所在的矢量值区间对多个所述第一子图像进行分类。其中,运动矢量值能够直接反应出图像的波动强度。After dividing the image frame into a plurality of first sub-images, calculating motion vector values of each of the first sub-images, and pairing the plurality of the first ones according to motion vector values of each of the first sub-images One son The image is classified, that is, a plurality of the first sub-images are classified according to a vector value interval in which the motion vector value of each of the first sub-images is located. Among them, the motion vector value can directly reflect the fluctuation strength of the image.
需要说明的是,在视频编码中,运动图像邻近图像帧的图像内容存在时域相关性。本实施例中,对每个所述第一子图像作运动补偿,在所述图像帧的相邻图像帧中寻找第一子图像的匹配块,并记录第一子图像的匹配块的运动矢量MVi,j=(Δx,Δy),
Figure PCTCN2017073227-appb-000002
为运动矢量值,其中,i为图像的宽度,j为图像的高度,Δx表示所述第一子图像在横轴(x轴)方向的位移,Δy表示所述第一子图像在纵轴(y轴)方向的位移。例如,参照图2,在t时刻的图像帧中选中一第一子图像,在t-1时刻相邻图像帧中进行最小失真搜索,获得最小失真的匹配块,并计算得出前述第一子图像和最小失真的匹配块的矢量距离,如图2中所示MV=(Δx,Δy),进而计算出选中的第一子图像的运动矢量值
Figure PCTCN2017073227-appb-000003
It should be noted that in video coding, the image content of the moving image adjacent to the image frame has time domain correlation. In this embodiment, motion compensation is performed for each of the first sub-images, a matching block of the first sub-image is searched for in an adjacent image frame of the image frame, and a motion vector of the matching block of the first sub-image is recorded. MV i,j =(Δx,Δy),
Figure PCTCN2017073227-appb-000002
Is a motion vector value, where i is the width of the image, j is the height of the image, Δx represents the displacement of the first sub-image in the horizontal axis (x-axis) direction, and Δy represents the first sub-image on the vertical axis ( The displacement in the y-axis) direction. For example, referring to FIG. 2, a first sub-image is selected in the image frame at time t, a minimum distortion search is performed in the adjacent image frame at time t-1, a matching block with minimum distortion is obtained, and the first sub-child is calculated. The vector distance of the matching block of the image and the minimum distortion, as shown in Fig. 2, MV = (Δx, Δy), thereby calculating the motion vector value of the selected first sub-image
Figure PCTCN2017073227-appb-000003
此外,本领域技术人员可以理解的是,当前选中的图像帧的相邻图像帧是指选中所述图像帧在帧序列上的前一图像帧。Moreover, those skilled in the art can understand that the adjacent image frame of the currently selected image frame refers to the previous image frame in which the image frame is selected on the frame sequence.
在完成第一子图像的分类后,计算每类第一子图像的峰值信噪比PSNR(Peak Signal to Noise Ratio,峰值信噪比)值。其中,PSNR是目前最普遍,最广泛使用的一种评价图像的客观标准。After the classification of the first sub-image is completed, a peak signal to noise ratio PSNR (Peak Signal to Noise Ratio) value of each type of first sub-image is calculated. Among them, PSNR is the most common and widely used objective standard for evaluating images.
步骤S20,计算每类第一子图像的PSNR值的平均值μ,以及计算每类第一子图像的PSNR值的标准方差σ,对σ与μ的比值采用预设修正参数修正后作为编码的波动强度;Step S20, calculating an average value μ of PSNR values of each type of first sub-image, and calculating a standard deviation σ of PSNR values of each type of first sub-image, and correcting the ratio of σ to μ by using a preset correction parameter as a coded Fluctuation intensity
本实施例中,每类第一子图像的PSNR值的平均值
Figure PCTCN2017073227-appb-000004
每类第一子图像的PSNR值的标准方差
Figure PCTCN2017073227-appb-000005
In this embodiment, the average value of the PSNR values of each type of first sub-image
Figure PCTCN2017073227-appb-000004
Standard deviation of PSNR values for each type of first sub-image
Figure PCTCN2017073227-appb-000005
其中,k为整数,每个矢量值区间对应一k值,Pk为每类第一子图像的PSNR值。Where k is an integer, each vector value interval corresponds to a k value, and P k is a PSNR value of each type of first sub-image.
在计算得出每类子图像的σ值与μ值之后,将σ与μ的比值使用预设修 正参数φ修正后作为编码的波动强度V,即波动强度
Figure PCTCN2017073227-appb-000006
所述φ值为经验参数,用于对σ与μ的比值进行归一化,提升处理速度,例如,本实施例将φ值设置为100。
After calculating the σ value and the μ value of each type of sub-image, the ratio of σ to μ is corrected using the preset correction parameter φ as the encoded fluctuation intensity V, that is, the fluctuation intensity.
Figure PCTCN2017073227-appb-000006
The φ value is an empirical parameter for normalizing the ratio of σ to μ to increase the processing speed. For example, the φ value is set to 100 in this embodiment.
此外,为提升处理速度,还可以设置最大k值kmax,并将运动矢量值大于kmax的第一子图像分入kmax区间中,其中,kmax为经验参数,例如,本实施例将kmax设置为9。In addition, in order to increase the processing speed, a maximum k value k max may also be set, and a first sub-image with a motion vector value greater than k max is divided into k max intervals, where k max is an empirical parameter, for example, this embodiment will k max is set to 9.
步骤S30,根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率,其中,根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率包括:In step S30, the target code rate of the encoding is adjusted according to the magnitude relationship between the fluctuation strength and the first preset threshold. The target code rate of the encoding is adjusted according to the magnitude relationship between the fluctuation strength and the first preset threshold.
当所述波动强度大于第一预设阈值时,增大编码的目标码率;When the fluctuation strength is greater than the first preset threshold, increasing the encoded target code rate;
当所述波动强度小于第一预设阈值时,减小编码的目标码率。When the fluctuation strength is less than the first predetermined threshold, the encoded target code rate is reduced.
本领域技术人员可以理解的是,在视频编码中,波动强度大的图像帧相较于波动强度小的图像帧需要更多的比特进行描述。因此,在本实施例中,在计算得到编码的波动强度V之后,判断所述波动强度V是否大于第一预设阈值,如果波动强度V大于第一预设阈值,则增大编码的目标码率;否则,如果波动强度V小于或等于第一预设阈值,则减小编码的目标码率。其中,所述第一预设阈值可以按实际需要进行设置,例如,本实施例将所述第一预设阈值设置为5,本实施例预设有目标码率调整的步长值TBRC,作为每次目标码率调整的基准。It will be understood by those skilled in the art that in video coding, an image frame having a large fluctuation intensity requires more bits to be described than an image frame having a small fluctuation intensity. Therefore, in this embodiment, after the calculated fluctuation strength V is calculated, it is determined whether the fluctuation strength V is greater than a first preset threshold, and if the fluctuation strength V is greater than the first preset threshold, the encoded target code is increased. Rate; otherwise, if the fluctuation strength V is less than or equal to the first predetermined threshold, the encoded target code rate is reduced. The first preset threshold may be set according to actual needs. For example, in this embodiment, the first preset threshold is set to 5. In this embodiment, the step value TBR C of the target rate adjustment is preset. As a basis for each target rate adjustment.
例如,参照图3,提供了本实施例的目标码率调整的实测图,如图3所示,本实施例在编码过程中,实时根据波动强度的变化对目标码率进行调整,以在尽可能低的比特占用下提供最小失真的视频图像视觉解码质量。For example, referring to FIG. 3, a measured view of the target code rate adjustment of the embodiment is provided. As shown in FIG. 3, in the encoding process, the target code rate is adjusted according to the change of the fluctuation intensity in real time. It is possible that the low bit occupancy occupies the visual decoding quality of the video image with minimal distortion.
此外,当所述波动强度V等于所述预设阈值时,不调整编码的目标码率。Further, when the fluctuation intensity V is equal to the preset threshold, the encoded target code rate is not adjusted.
在其他实施例中,还可以设置第一预设阈值区间,当所述波动强度V大于所述第一预设阈值区间中的最大值时,增大编码的目标码率;当所述波动强度V位于所述第一预设阈值区间内时,不调整编码的目标码率;当所述波动强度V小于所述第一预设阈值区间中最小值时,减小编码的目标码率。例如,设置所述第一预设区间为[4,5]。In other embodiments, a first preset threshold interval may be further set, when the fluctuation strength V is greater than a maximum value in the first preset threshold interval, increasing a target code rate of the encoding; when the fluctuation strength is When the V is located in the first preset threshold interval, the encoded target code rate is not adjusted; when the fluctuation strength V is smaller than the minimum value in the first preset threshold interval, the encoded target code rate is reduced. For example, the first preset interval is set to [4, 5].
本实施例提出的目标码率调整方法,将待编码的图像帧划分为多个第一 子图像,并按照每个所述第一子图像的运动矢量值对多个所述第一子图像进行分类,计算每类第一子图像的峰值信噪比PSNR值,再对每类第一子图像的PSNR值的标准方差σ以及平均值μ的比值采用预设修正参数修正后作为编码的波动强度,得到的波动强度包括了图像帧的重构失真以及运动补偿的特征。当波动强度在编码过程中增大时,基于邻近图像帧的时域相关性,所述待编码的图像帧的下一待编码的图像帧需要更多的比特进行描述(即编码),因此,相较于相关技术通过假想值选取目标码率,本发明实施例的技术方案通过波动强度实时进行编码的目标码率的调整,能够更准确地反映编码需要的比特,提高选取的目标码率的准确度。The target rate adjustment method proposed in this embodiment divides an image frame to be encoded into a plurality of first a sub-image, and classifying the plurality of first sub-images according to motion vector values of each of the first sub-images, calculating a peak signal-to-noise ratio PSNR value of each type of first sub-image, and then first The ratio of the standard deviation σ of the PSNR value of the sub-image and the average value μ is corrected by the preset correction parameter as the encoded fluctuation intensity, and the obtained fluctuation intensity includes the reconstruction distortion of the image frame and the characteristics of the motion compensation. When the fluctuation strength increases during the encoding process, based on the time domain correlation of the adjacent image frames, the next image frame to be encoded of the image frame to be encoded requires more bits for description (ie, encoding), therefore, Compared with the related art, the target code rate is selected by the imaginary value. The technical solution of the embodiment of the present invention can accurately reflect the bit required for the coding by adjusting the target code rate of the coded in real time by the fluctuation strength, and improve the selected target bit rate. Accuracy.
实施例二Embodiment 2
基于实施例一,在本实施例中,上述步骤S30之前,所述目标码率调整方法还包括:Based on the first embodiment, in the embodiment, before the step S30, the target rate adjustment method further includes:
记录当前计算的波动强度,并在记录的波动强度的数量达到第二预设阈值时,计算记录的波动强度的平均值;Recording the currently calculated fluctuation intensity, and calculating an average value of the recorded fluctuation strength when the recorded fluctuation intensity reaches the second preset threshold;
将编码的所述波动强度更新为计算的所述平均值。The encoded wave strength is updated to the calculated average.
由于运动图像邻近图像帧的图像内容存在时域相关性,相邻的连续多个图像帧的图像内容往往大致相同,相应的,短时间内编码的波动强度的变化往往可以忽略。在实际应用中,虽然每编码一帧就计算一次编码的波动强度,但是较长时间才会进行一次目标码率的调整,存在一定处理资源的浪费。因此,在本实施例中,设置一个大小为τ(前述第二预设阈值,具体可按实际需要进行设置)的窗口,每τ帧统计一次窗口内图像帧的平均波动强度,以确定是否进行目标码率的调整。其中,τ为大于0的正数,例如取值范围可以设定为[1,30]。Since the image content of the moving image adjacent to the image frame has time domain correlation, the image content of the adjacent consecutive multiple image frames tends to be substantially the same, and correspondingly, the variation of the fluctuation intensity of the encoding in a short time is often negligible. In practical applications, although the fluctuation strength of the encoding is calculated once per frame, the target rate is adjusted once in a long time, and there is a waste of processing resources. Therefore, in this embodiment, a window having a size of τ (the aforementioned second preset threshold, specifically, can be set as needed) is set, and the average fluctuation intensity of the image frame in the window is counted every τ frame to determine whether to perform The adjustment of the target bit rate. Where τ is a positive number greater than 0, for example, the value range can be set to [1, 30].
在本实施例中,每完成一帧待编码的图像帧的编码并计算编码的波动强度之后,记录当次计算的波动强度,并在记录τ个计算的波动强度时,统计一次窗口内图像帧的平均波动强度
Figure PCTCN2017073227-appb-000007
将编码的波动强度更新为计算的平均波动强度
Figure PCTCN2017073227-appb-000008
进而进行编码的目标码率的调整,具体可参照前述实施 例,此处不再赘述。其中,t为τ的整数倍,t用于表示对应的图像帧在帧序列中的位置。
In this embodiment, after completing the encoding of the image frame to be encoded and calculating the fluctuating intensity of the encoding, the fluctuation intensity of the current calculation is recorded, and when the calculated fluctuation intensity of the τ is recorded, the image frame within the window is counted. Average fluctuation intensity
Figure PCTCN2017073227-appb-000007
Update the encoded wave strength to the calculated average wave strength
Figure PCTCN2017073227-appb-000008
For the adjustment of the target code rate of the coding, reference may be made to the foregoing embodiment, and details are not described herein again. Where t is an integer multiple of τ, and t is used to indicate the position of the corresponding image frame in the sequence of frames.
在其他实施例中,在记录当前计算的波动强度时,还可基于上次计算的波动强度对当前计算的波动强度进行平滑处理,消除编码过程中噪声的影响,在本实施例中,将当前计算的波动强度记录为:a·Vt-1+b·VtIn other embodiments, when the currently calculated fluctuation strength is recorded, the currently calculated fluctuation intensity may also be smoothed based on the last calculated fluctuation intensity to eliminate the influence of noise during the encoding process. In this embodiment, the current The calculated fluctuation intensity is recorded as: a·V t-1 +b·V t ;
其中,a与b为经验参数(例如,本实施例中a取值为0.1,b取值为0.9)Vt-1表示上次计算的波动强度,Vt表示当前计算的波动强度。Where a and b are empirical parameters (for example, in this embodiment, a takes a value of 0.1 and b takes a value of 0.9). V t-1 represents the last calculated fluctuation intensity, and V t represents the currently calculated fluctuation intensity.
本实施例通过间隔一定时间判断是否需要进行目标码率的调整,以及如何调整,在保证选取目标码率的准确度的基础上,降低了对处理资源的消耗。In this embodiment, it is determined whether the target code rate needs to be adjusted and how to adjust by a certain interval, and the processing resource consumption is reduced on the basis of ensuring the accuracy of selecting the target code rate.
实施例三Embodiment 3
可选地,基于实施例一,参照图4,在本实施例中,上述步骤S10包括:Optionally, based on the first embodiment, referring to FIG. 4, in the embodiment, the foregoing step S10 includes:
步骤S101,将待编码的图像帧划分为多个第一子图像,计算待编码的所述图像帧每个所述第一子图像相对于相邻图像帧的运动矢量值,按照各所述第一子图像的运动矢量值所在的矢量值区间对所述多个第一子图像进行分类;Step S101, dividing an image frame to be encoded into a plurality of first sub-images, and calculating a motion vector value of each of the first sub-images of the image frame to be encoded relative to adjacent image frames, according to each of the Sorting the plurality of first sub-images by a vector value interval in which a motion vector value of a sub-image is located;
一个连续的视频是由一系列的图像帧组成的,为方便计算,在本实施例中,将待编码的图像帧划分为多个呈正方形的第一子图像。本领域技术人员可以理解的是,在其他实施例中,可以按实际需要选择划分第一子图像的形状,例如,可以将所述图像帧划分为多个呈长方形的第一子图像。在本实施例中,划分得到第一子图像的个数取决于第一子图像的大小,以所述图像帧的像素点宽为W、像素点高为H,第一子图像的大小为n*n为例,划分得到第一子图像的个数N=WB×HB,其中
Figure PCTCN2017073227-appb-000009
为上取整运算。可选地,为了提升处理的速度,可以将第一子图像的大小设为64*64。
A continuous video is composed of a series of image frames. For the convenience of calculation, in the embodiment, the image frame to be encoded is divided into a plurality of first sub-images in a square shape. It can be understood by those skilled in the art that in other embodiments, the shape of the first sub-image may be selected according to actual needs. For example, the image frame may be divided into a plurality of first sub-images that are rectangular. In this embodiment, the number of the first sub-images divided depends on the size of the first sub-image, wherein the pixel width of the image frame is W, the pixel height is H, and the size of the first sub-image is n. *n is an example, and the number of the first sub-images is divided into N=WB×HB, wherein
Figure PCTCN2017073227-appb-000009
Round up the operation. Optionally, in order to increase the speed of the processing, the size of the first sub-image may be set to 64*64.
在将所述图像帧划分为多个第一子图像之后,计算每个所述第一子图像的运动矢量值,并按照每个所述第一子图像的运动矢量值对多个所述第一子图像进行分类,即按照每个所述第一子图像的运动矢量值所在的矢量值区间对多个所述第一子图像进行分类。其中,运动矢量值能够直接反应出图像的波动强度。After dividing the image frame into a plurality of first sub-images, calculating motion vector values of each of the first sub-images, and pairing the plurality of the first ones according to motion vector values of each of the first sub-images A sub-image is classified, that is, a plurality of the first sub-images are classified according to a vector value interval in which the motion vector value of each of the first sub-images is located. Among them, the motion vector value can directly reflect the fluctuation strength of the image.
需要说明的是,在视频编码中,运动图像邻近图像帧的图像内容存在时 域相关性。本实施例中,对每个所述第一子图像作运动补偿,在所述图像帧的相邻图像帧中寻找第一子图像的匹配块,并记录第一子图像的匹配块的运动矢量MVi,j=(Δx,Δy),
Figure PCTCN2017073227-appb-000010
为运动矢量值,其中,Δx表示所述第一子图像在x轴方向的位移,Δy表示所述第一子图像在y轴方向的位移。例如,参照图2,在t时刻的图像帧中选中一第一子图像,将在t-1时刻相邻图像帧中进行最小失真搜索,获得最小失真的匹配块,并计算得出前述第一子图像和最小失真的匹配块的矢量距离,如图2中所示MV=(Δx,Δy),进而计算出选中的第一子图像的运动矢量值
Figure PCTCN2017073227-appb-000011
计算的所述图像帧的每个第一子图像的运动矢量分布,如图5所示。
It should be noted that in video coding, the image content of the moving image adjacent to the image frame has a time domain correlation. In this embodiment, motion compensation is performed for each of the first sub-images, a matching block of the first sub-image is searched for in an adjacent image frame of the image frame, and a motion vector of the matching block of the first sub-image is recorded. MV i,j =(Δx,Δy),
Figure PCTCN2017073227-appb-000010
Is a motion vector value, where Δx represents the displacement of the first sub-image in the x-axis direction, and Δy represents the displacement of the first sub-image in the y-axis direction. For example, referring to FIG. 2, a first sub-image is selected in the image frame at time t, and a minimum distortion search is performed in the adjacent image frame at time t-1 to obtain a minimum distortion matching block, and the first first is calculated. The vector distance of the sub-image and the minimum distortion matching block, as shown in Fig. 2, MV = (Δx, Δy), thereby calculating the motion vector value of the selected first sub-image
Figure PCTCN2017073227-appb-000011
The calculated motion vector distribution of each of the first sub-images of the image frame is as shown in FIG.
步骤S102,按照与待编码的所述图像帧相同的划分方式将待编码的所述图像帧的重构图像帧划分为多个第二子图像,计算每个所述第一子图像以及每个所述第一子图像对应的第二子图像之间的均方误差;Step S102, dividing the reconstructed image frame of the image frame to be encoded into a plurality of second sub-images according to the same division manner as the image frame to be encoded, and calculating each of the first sub-images and each a mean square error between the second sub-images corresponding to the first sub-image;
本领域技术人员可以理解的是,在帧间预测编码中,编码的下一帧基于当前帧的重构帧进行编码。在本实施例中,按照与待编码的所述图像帧相同的划分方式将待编码的所述图像帧的重构图像帧划分为多个第二子图像,计算每个所述第一子图像以及每个所述第一子图像对应的第二子图像之间的均方误差,其中,所述第一子图像与其对应的第二子图像之间的均方误差
Figure PCTCN2017073227-appb-000012
表示第一子图像的标准方差,
Figure PCTCN2017073227-appb-000013
表示第二子图像标准方差。
It will be understood by those skilled in the art that in inter prediction coding, the next frame of coding is encoded based on the reconstructed frame of the current frame. In this embodiment, the reconstructed image frame of the image frame to be encoded is divided into a plurality of second sub-images in the same division manner as the image frame to be encoded, and each of the first sub-images is calculated. And a mean square error between the second sub-images corresponding to each of the first sub-images, wherein a mean square error between the first sub-image and its corresponding second sub-image
Figure PCTCN2017073227-appb-000012
Represents the standard deviation of the first sub-image,
Figure PCTCN2017073227-appb-000013
Indicates the standard deviation of the second sub-image.
步骤S103,基于每个所述均方误差计算每个类第一子图像的PSNR值。Step S103, calculating a PSNR value of each class first sub-image based on each of the mean square errors.
本实施例中,首先统计每个类第一子图像的平均失真Dk=∑Di,j|k<||MVi,j||<k+1,其中,
Figure PCTCN2017073227-appb-000014
为运动矢量大小,k为整数,每个前述的矢量值区间对应一k值。
In this embodiment, the average distortion D k of the first sub-image of each class is first counted as ∑D i,j |k<||MV i,j ||<k+1, where
Figure PCTCN2017073227-appb-000014
For the motion vector size, k is an integer, and each of the aforementioned vector value intervals corresponds to a k value.
然后再基于每个类第一子图像的平均失真计算每个类第一子图像的PSN R值,每个类第一子图像的PSNR值
Figure PCTCN2017073227-appb-000015
其中,bpp表示像素点灰度值用二进制表示时的位数,如在0到255灰度级表示中,bpp的取值为8。
Then calculating the PSN R value of the first sub-image of each class based on the average distortion of the first sub-image of each class, and the PSNR value of the first sub-image of each class
Figure PCTCN2017073227-appb-000015
Where bpp represents the number of bits when the pixel point gray value is expressed in binary, as in the 0 to 255 gray level representation, the value of bpp is 8.
实施例四Embodiment 4
可选地,基于前述任一实施例,在本实施例中,上述步骤S30之后,所述目标码率调整方法还包括:Optionally, based on any of the foregoing embodiments, in the embodiment, after the step S30, the target rate adjustment method further includes:
基于当前的网络带宽对调整后的所述目标码率进行修正,以采用修正后的目标码率进行编码。The adjusted target code rate is corrected based on the current network bandwidth to be encoded using the corrected target code rate.
需要说明的是,本实施例的所述网络带宽是指可供用于编码的视频传输的网络带宽,本领域技术人员可以理解的是,由于网络是动态变化的,而且也存在网络带宽被本地资源抢占的问题,因此,为确保编码的视频的传输流畅性,在本实施例中,获取当前可用的网络带宽,并基于获取的所述网络带宽对调整后的所述目标码率进行修正,采用修正后的目标码率进行编码。It should be noted that the network bandwidth in this embodiment refers to the network bandwidth available for encoding video transmission, and those skilled in the art may understand that the network bandwidth is dynamically changed, and the network bandwidth is also local resources. The problem of preemption, therefore, in order to ensure the smoothness of the transmission of the encoded video, in this embodiment, the currently available network bandwidth is obtained, and the adjusted target bit rate is corrected based on the obtained network bandwidth, and the method is adopted. The corrected target bit rate is encoded.
可选地,所述基于当前的网络带宽对调整后的所述目标码率进行修正包括:Optionally, the correcting the adjusted target bit rate based on the current network bandwidth includes:
判断当前的网络带宽是否大于调整后的所述目标码率;Determining whether the current network bandwidth is greater than the adjusted target code rate;
在当前的网络带宽小于调整后的所述目标码率时,将所述网络带宽作为修正后的所述目标码率。When the current network bandwidth is less than the adjusted target code rate, the network bandwidth is used as the corrected target code rate.
容易理解的是,当所述网络带宽小于调整后的所述目标码率时,若采用调整后的所述目标码率进行编码,编码后的视频数据将不能流畅的传输至目标终端,导致播放卡顿等问题,影响用户的视觉体验。因此,本实施例中,在当前的网络带宽小于调整后的所述目标码率时,将所述网络带宽作为修正后的所述目标码率,以确保编码后的视频数据能够流畅的传输至目标终端。It is easy to understand that when the network bandwidth is smaller than the adjusted target code rate, if the adjusted target bit rate is used for encoding, the encoded video data cannot be smoothly transmitted to the target terminal, resulting in playback. Problems such as Caton affect the user's visual experience. Therefore, in this embodiment, when the current network bandwidth is less than the adjusted target code rate, the network bandwidth is used as the corrected target code rate to ensure that the encoded video data can be smoothly transmitted to Target terminal.
实施例五Embodiment 5
本发明实施例提供一种目标码率调整装置,参照图6,所述目标码率调整装置包括:An embodiment of the present invention provides a target rate adjustment apparatus. Referring to FIG. 6, the target rate adjustment apparatus includes:
第一计算模块10,设置为将待编码的图像帧划分为多个第一子图像,并按照每个所述第一子图像的运动矢量值对所述多个第一子图像进行分类,计算每个类第一子图像的峰值信噪比PSNR值;The first calculating module 10 is configured to divide the image frame to be encoded into a plurality of first sub-images, and classify the plurality of first sub-images according to motion vector values of each of the first sub-images, and calculate Peak signal to noise ratio PSNR value of the first sub-image of each class;
本实施例提出的目标码率调整装置可以应用于流媒体的视频编码控制中,例如,在编码时,通过运动补偿矢量计算,并结合重构图像帧的失真统计来进行编码的目标码率的选取,以准确的选取合适的目标码率,在保证视频质 量的同时降低对网络带宽的占用。The target rate adjustment apparatus proposed in this embodiment may be applied to video coding control of a streaming media, for example, at the time of encoding, by performing motion compensation vector calculation, and combining the distortion statistics of the reconstructed image frame to perform coding of the target code rate. Select to accurately select the appropriate target bit rate to ensure video quality The amount of time reduces the occupation of network bandwidth.
由于一个连续的视频是由一系列的图像帧组成的,为方便计算,在本实施例中,第一计算模块10将待编码的图像帧划分为多个呈正方形的第一子图像。本领域技术人员可以理解的是,在其他实施例中,可以按实际需要选择划分第一子图像的形状,例如,第一计算模块10可以将所述图像帧划分为多个呈长方形的第一子图像。Since a continuous video is composed of a series of image frames, in order to facilitate calculation, in the embodiment, the first calculation module 10 divides the image frame to be encoded into a plurality of first sub-images in a square shape. It can be understood by those skilled in the art that in other embodiments, the shape of the first sub-image may be selected according to actual needs. For example, the first calculation module 10 may divide the image frame into a plurality of rectangles. Sub image.
在本实施例中,第一计算模块10划分得到第一子图像的个数取决于第一子图像的大小,以所述图像帧的像素点宽为W、像素点高为H,第一子图像的大小为n*n为例,划分得到第一子图像的个数N=WB×HB,其中
Figure PCTCN2017073227-appb-000016
Figure PCTCN2017073227-appb-000017
为上取整运算。可选地,为了提升处理的速度,可以将第一子图像的大小设为64*64。
In this embodiment, the number of the first sub-images obtained by the first calculation module 10 depends on the size of the first sub-image, and the pixel width of the image frame is W, and the pixel height is H, the first sub- The size of the image is n*n as an example, and the number of the first sub-images is divided into N=WB×HB, where
Figure PCTCN2017073227-appb-000016
Figure PCTCN2017073227-appb-000017
Round up the operation. Optionally, in order to increase the speed of the processing, the size of the first sub-image may be set to 64*64.
在将所述图像帧划分为多个第一子图像之后,第一计算模块10计算每个所述第一子图像的运动矢量值,并按照每个所述第一子图像的运动矢量值对多个所述第一子图像进行分类,即按照每个所述第一子图像的运动矢量值所在的矢量值区间对多个所述第一子图像进行分类。其中,运动矢量值能够直接反应出图像的波动强度。After dividing the image frame into a plurality of first sub-images, the first calculation module 10 calculates a motion vector value of each of the first sub-images, and performs motion vector value pairs for each of the first sub-images. The plurality of first sub-images are classified, that is, a plurality of the first sub-images are classified according to a vector value interval in which the motion vector value of each of the first sub-images is located. Among them, the motion vector value can directly reflect the fluctuation strength of the image.
需要说明的是,在视频编码中,运动图像邻近图像帧的图像内容存在时域相关性。本实施例中,第一计算模块10对每个所述第一子图像作运动补偿,在所述图像帧的相邻图像帧中寻找第一子图像的匹配块,并记录第一子图像的匹配块的运动矢量MVi,j=(Δx,Δy),
Figure PCTCN2017073227-appb-000018
为运动矢量值,其中,Δx表示所述第一子图像在x轴方向的位移,Δy表示所述第一子图像在y轴方向的位移。例如,参照图2,在t时刻的图像帧中选中一第一子图像,将在t-1时刻相邻图像帧中进行最小失真搜索,获得最小失真的匹配块,并计算得出前述第一子图像和最小失真的匹配块的矢量距离,如图2中所示MV=(Δx,Δy),进而计算出选中的第一子图像的运动矢量值
Figure PCTCN2017073227-appb-000019
It should be noted that in video coding, the image content of the moving image adjacent to the image frame has time domain correlation. In this embodiment, the first calculating module 10 performs motion compensation on each of the first sub-images, searches for matching blocks of the first sub-image in adjacent image frames of the image frame, and records the first sub-image. Matching block motion vector MV i,j =(Δx, Δy),
Figure PCTCN2017073227-appb-000018
Is a motion vector value, where Δx represents the displacement of the first sub-image in the x-axis direction, and Δy represents the displacement of the first sub-image in the y-axis direction. For example, referring to FIG. 2, a first sub-image is selected in the image frame at time t, and a minimum distortion search is performed in the adjacent image frame at time t-1 to obtain a minimum distortion matching block, and the first first is calculated. The vector distance of the sub-image and the minimum distortion matching block, as shown in Fig. 2, MV = (Δx, Δy), thereby calculating the motion vector value of the selected first sub-image
Figure PCTCN2017073227-appb-000019
此外,本领域技术人员可以理解的是,当前选中的图像帧的相邻图像帧是指选中所述图像帧的在帧序列上的前一图像帧。Moreover, those skilled in the art can understand that the adjacent image frame of the currently selected image frame refers to the previous image frame on the frame sequence in which the image frame is selected.
在完成第一子图像的分类后,第一计算模块10计算每个类第一子图像的峰值信噪比PSNR(Peak Signal to Noise Ratio,峰值信噪比)值。其中,PSNR 是目前最普遍,最广泛使用的一种评价图像的客观标准。After completing the classification of the first sub-image, the first calculation module 10 calculates a Peak Signal to Noise Ratio (PSNR) value of the first sub-image of each class. Where PSNR It is the most common and widely used objective standard for evaluating images.
第二计算模块20,设置为计算每个类第一子图像的PSNR值的平均值μ,以及计算每个类第一子图像的PSNR值的标准方差σ,对σ与μ的比值采用预设修正参数修正后作为编码的波动强度;The second calculating module 20 is configured to calculate an average value μ of the PSNR values of the first sub-images of each class, and calculate a standard deviation σ of the PSNR values of the first sub-images of each class, and preset a ratio of σ to μ Correct the fluctuation intensity of the code as the code after correction;
本实施例中,每个类第一子图像的PSNR值的平均值
Figure PCTCN2017073227-appb-000020
每个类第一子图像的PSNR值的标准方差
Figure PCTCN2017073227-appb-000021
In this embodiment, the average value of the PSNR values of the first sub-images of each class
Figure PCTCN2017073227-appb-000020
Standard deviation of PSNR values for the first sub-image of each class
Figure PCTCN2017073227-appb-000021
其中,k为整数,每个矢量值区间对应一k值,Pk为各类第一子图像的PSNR值。Where k is an integer, each vector value interval corresponds to a k value, and P k is a PSNR value of each type of first sub-image.
在计算得出每类子图像的σ值与μ值之后,第二计算模块20将σ与μ的比值使用预设修正参数φ修正后作为编码的波动强度V,即波动强度
Figure PCTCN2017073227-appb-000022
所述φ值为经验参数,用于对σ与μ的比值进行归一化,提升处理速度,例如,本实施例将φ值设置为100。
After calculating the σ value and the μ value of each type of sub-image, the second calculation module 20 corrects the ratio of σ to μ using the preset correction parameter φ as the encoded fluctuation intensity V, that is, the fluctuation intensity.
Figure PCTCN2017073227-appb-000022
The φ value is an empirical parameter for normalizing the ratio of σ to μ to increase the processing speed. For example, the φ value is set to 100 in this embodiment.
此外,为提升处理速度,还可以设置最大k值kmax,并将运动矢量值大于kmax的第一子图像分入kmax区间中,其中,kmax为经验参数,例如,本实施例将kmax设置为9。In addition, in order to increase the processing speed, a maximum k value k max may also be set, and a first sub-image with a motion vector value greater than k max is divided into k max intervals, where k max is an empirical parameter, for example, this embodiment will k max is set to 9.
调整模块30,设置为根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率,其中,根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率包括:当所述波动强度大于第一预设阈值时,增大编码的目标码率;The adjusting module 30 is configured to adjust the target code rate of the encoding according to the magnitude relationship between the fluctuation strength and the first preset threshold, where the target code rate of the encoding is adjusted according to the magnitude relationship between the fluctuation strength and the first preset threshold. : increasing the target code rate of the encoding when the fluctuation strength is greater than the first preset threshold;
当所述波动强度小于第一预设阈值时,减小编码的目标码率。When the fluctuation strength is less than the first predetermined threshold, the encoded target code rate is reduced.
本领域技术人员可以理解的是,在视频编码中,波动强度大的图像帧相较于波动强度小的图像帧需要更多的比特进行描述。因此,在本实施例中,在所述第二计算模块20计算得到编码的编码的波动强度V之后,调整模块30判断所述波动强度V是否大于第一预设阈值,如果波动强度V大于第一预设阈值,则增大编码的目标码率;否则,如果波动强度V小于或等于第一预设阈值,则减小编码的目标码率。其中,所述第一预设阈值按实际需要进行 设置,例如,本实施例将所述第一预设阈值设置为5,本实施例预设有目标码率调整的步长值TBRC,作为每次目标码率调整的基准。It will be understood by those skilled in the art that in video coding, an image frame having a large fluctuation intensity requires more bits to be described than an image frame having a small fluctuation intensity. Therefore, in this embodiment, after the second calculation module 20 calculates the obtained coded fluctuation strength V, the adjustment module 30 determines whether the fluctuation intensity V is greater than a first preset threshold, and if the fluctuation strength V is greater than the first A predetermined threshold increases the encoded target rate; otherwise, if the fluctuation intensity V is less than or equal to the first predetermined threshold, the encoded target code rate is decreased. The first preset threshold is set according to actual needs. For example, in this embodiment, the first preset threshold is set to 5. In this embodiment, the step value TBR C of the target rate adjustment is preset. The benchmark for each target rate adjustment.
例如,参照图3,提供了本实施例的目标码率调整的实测图,如图3所示,本实施例在编码过程中,实时根据波动强度的变化对目标码率进行调整,以在尽可能低的比特占用下提供最小失真的视频图像视觉解码质量。For example, referring to FIG. 3, a measured view of the target code rate adjustment of the embodiment is provided. As shown in FIG. 3, in the encoding process, the target code rate is adjusted according to the change of the fluctuation intensity in real time. It is possible that the low bit occupancy occupies the visual decoding quality of the video image with minimal distortion.
此外,当所述波动强度V等于所述预设阈值时,不调整编码的目标码率。Further, when the fluctuation intensity V is equal to the preset threshold, the encoded target code rate is not adjusted.
在其他实施例中,还可以设置第一预设阈值区间,当所述波动强度V大于所述第一预设阈值区间中的最大值时,增大编码的目标码率;当所述波动强度V位于所述第一预设阈值区间内时,不调整编码的目标码率;当所述波动强度V小于所述第一预设阈值区间中最小值时,减小编码的目标码率。例如,设置所述第一预设区间为[4,5]。In other embodiments, a first preset threshold interval may be further set, when the fluctuation strength V is greater than a maximum value in the first preset threshold interval, increasing a target code rate of the encoding; when the fluctuation strength is When the V is located in the first preset threshold interval, the encoded target code rate is not adjusted; when the fluctuation strength V is smaller than the minimum value in the first preset threshold interval, the encoded target code rate is reduced. For example, the first preset interval is set to [4, 5].
本实施例提出的目标码率调整装置,将待编码的图像帧划分为多个第一子图像,并按照每个所述第一子图像的运动矢量值对多个所述第一子图像进行分类,计算每类第一子图像的峰值信噪比PSNR值,再对每类第一子图像的PSNR值的标准方差σ以及平均值μ的比值采用预设修正参数修正后作为编码的波动强度,得到的波动强度包括了图像帧的重构失真以及运动补偿的特征。当波动强度在编码过程中增大时,基于邻近图像帧的时域相关性,所述待编码的图像帧的下一待编码的图像帧需要更多的比特进行描述(即编码),因此,相较于相关技术通过假想值选取目标码率,本发明实施例的技术方案通过波动强度实时进行编码的目标码率的调整,能够更准确地反映编码需要的比特,提高选取的目标码率的准确度。The target rate adjustment apparatus of the present embodiment divides an image frame to be encoded into a plurality of first sub-images, and performs a plurality of the first sub-images according to motion vector values of each of the first sub-images. Classification, calculating the peak signal-to-noise ratio PSNR value of each type of first sub-image, and then comparing the standard deviation σ of the PSNR value of each type of the first sub-image with the average value μ as the encoded fluctuation intensity by using the preset correction parameter The resulting wave strength includes the reconstruction distortion of the image frame and the characteristics of motion compensation. When the fluctuation strength increases during the encoding process, based on the time domain correlation of the adjacent image frames, the next image frame to be encoded of the image frame to be encoded requires more bits for description (ie, encoding), therefore, Compared with the related art, the target code rate is selected by the imaginary value. The technical solution of the embodiment of the present invention can accurately reflect the bit required for the coding by adjusting the target code rate of the coded in real time by the fluctuation strength, and improve the selected target bit rate. Accuracy.
实施例六Embodiment 6
可选地,基于实施例六,在本实施例中,所述目标码率调整装置还包括:Optionally, based on the sixth embodiment, in the embodiment, the target rate adjustment apparatus further includes:
记录模块,设置为记录当前计算的波动强度,并在记录的波动强度的数量达到第二预设阈值时,计算记录的波动强度的平均值;a recording module configured to record the currently calculated fluctuation intensity, and calculate an average value of the recorded fluctuation strength when the recorded fluctuation intensity reaches a second preset threshold;
更新模块,设置为将编码的所述波动强度更新为计算的所述平均值。An update module is arranged to update the encoded wave strength to the calculated average.
本领域技术人员可以理解的是,由于运动图像邻近图像帧的图像内容存在时域相关性,相邻的连续多个图像帧的图像内容往往大致相同,相应的,短时间内编码的波动强度的变化往往可以忽略。即在实际应用中,虽然每编 码一帧就计算一次编码的波动强度,但是较长时间才会进行一次目标码率的调整,存在一定处理资源的浪费。因此,在本实施例中,设置一个大小为τ(前述第二预设阈值,具体可按实际需要进行设置)的窗口,每τ帧统计一次窗口内图像帧的平均波动强度,以确定是否进行目标码率的调整。It can be understood by those skilled in the art that since the image content of the moving image adjacent to the image frame has time domain correlation, the image content of the adjacent consecutive multiple image frames tends to be substantially the same, correspondingly, the fluctuation intensity of the encoding in a short time. Changes are often negligible. That is, in practical applications, although each The code fluctuating intensity is calculated once for one frame, but the target bit rate is adjusted once for a long time, and there is a waste of processing resources. Therefore, in this embodiment, a window having a size of τ (the aforementioned second preset threshold, specifically, can be set as needed) is set, and the average fluctuation intensity of the image frame in the window is counted every τ frame to determine whether to perform The adjustment of the target bit rate.
在本实施例中,每完成一帧待编码的图像帧的编码并计算编码的波动强度之后,记录模块记录当次计算的波动强度,并在记录τ个计算的波动强度时,统计一次窗口内图像帧的平均波动强度
Figure PCTCN2017073227-appb-000023
更新模块将编码的波动强度更新为计算的平均波动强度
Figure PCTCN2017073227-appb-000024
进而供所述调整模块30进行编码的目标码率的调整,具体可参照前述实施例,此处不再赘述。其中,t为τ的整数倍,t用于表示对应的图像帧在帧序列中的位置。
In this embodiment, after completing the encoding of the image frame to be encoded and calculating the fluctuating intensity of the encoding, the recording module records the fluctuating intensity calculated at the time, and counts the calculated fluctuating intensity in the current window. Average fluctuation intensity of image frames
Figure PCTCN2017073227-appb-000023
The update module updates the encoded wave strength to the calculated average wave strength
Figure PCTCN2017073227-appb-000024
For the adjustment of the target code rate for the encoding by the adjustment module 30, reference may be made to the foregoing embodiments, and details are not described herein again. Where t is an integer multiple of τ, and t is used to indicate the position of the corresponding image frame in the sequence of frames.
在其他实施例中,所述记录模块在记录当前计算的波动强度时,还可基于上次计算的波动强度对当前计算的波动强度进行平滑处理,消除编码过程中噪声的影响,在本实施例中,所述记录模块将当前计算的波动强度记录为:a·Vt-1+b·VtIn other embodiments, when recording the currently calculated fluctuation strength, the recording module may further smooth the currently calculated fluctuation intensity based on the last calculated fluctuation intensity to eliminate the influence of noise in the encoding process, in this embodiment. The recording module records the currently calculated fluctuation strength as: a·V t-1 +b·V t ;
其中,a与b为经验参数(例如,本实施例中a取值为0.1,b取值为0.9)Vt-1表示上次计算的波动强度,Vt表示当前计算的波动强度。Where a and b are empirical parameters (for example, in this embodiment, a takes a value of 0.1 and b takes a value of 0.9). V t-1 represents the last calculated fluctuation intensity, and V t represents the currently calculated fluctuation intensity.
本实施例通过间隔一定时间判断是否需要进行目标码率的调整,以及如何调整,在保证选取目标码率的准确度的基础上,降低了对处理资源的消耗。In this embodiment, it is determined whether the target code rate needs to be adjusted and how to adjust by a certain interval, and the processing resource consumption is reduced on the basis of ensuring the accuracy of selecting the target code rate.
实施例七Example 7
基于实施例五,参照图7,在本实施例中,所述第一计算模块10包括:Based on the fifth embodiment, referring to FIG. 7, in the embodiment, the first calculating module 10 includes:
分类单元101,设置为将待编码的图像帧划分为多个第一子图像,计算待编码的所述图像帧每个所述第一子图像相对于相邻图像帧的运动矢量值,按照各所述第一子图像的运动矢量值所在的矢量值区间对所述多个第一子图像进行分类;The classification unit 101 is configured to divide the image frame to be encoded into a plurality of first sub-images, and calculate a motion vector value of each of the first sub-images of the image frame to be encoded relative to adjacent image frames, according to each Sorting the plurality of first sub-images by a vector value interval in which the motion vector value of the first sub-image is located;
一个连续的视频是由一系列的图像帧组成的,为方便计算,在本实施例中,分类单元101将待编码的图像帧划分为多个呈正方形的第一子图像。本 领域技术人员可以理解的是,在其他实施例中,可以按实际需要选择划分第一子图像的形状,例如,分类单元101可以将所述图像帧划分为多个呈长方形的第一子图像。在本实施例中,划分得到第一子图像的个数取决于第一子图像的大小,以所述图像帧的像素点宽为W、像素点高为H,第一子图像的大小为n*n为例,则划分得到第一子图像的个数N=WB×HB,其中
Figure PCTCN2017073227-appb-000025
Figure PCTCN2017073227-appb-000026
为上取整运算。可选地,为了提升处理的速度,可以将第一子图像的大小设为64*64。
A continuous video is composed of a series of image frames. For convenience of calculation, in the present embodiment, the classification unit 101 divides the image frame to be encoded into a plurality of first sub-images in a square shape. It can be understood by those skilled in the art that in other embodiments, the shape of the first sub-image may be selected according to actual needs. For example, the classification unit 101 may divide the image frame into a plurality of first sub-images that are rectangular. . In this embodiment, the number of the first sub-images divided depends on the size of the first sub-image, wherein the pixel width of the image frame is W, the pixel height is H, and the size of the first sub-image is n. *n is an example, the number of the first sub-images is divided into N=WB×HB, where
Figure PCTCN2017073227-appb-000025
Figure PCTCN2017073227-appb-000026
Round up the operation. Optionally, in order to increase the speed of the processing, the size of the first sub-image may be set to 64*64.
在将所述图像帧划分为多个第一子图像之后,分类单元101计算每个所述第一子图像的运动矢量值,并按照每个所述第一子图像的运动矢量值对多个所述第一子图像进行分类,即按照每个所述第一子图像的运动矢量值所在的矢量值区间对所述多个第一子图像进行分类。其中,本领域技术人员可以理解的是,运动矢量值能够直接反应出图像的波动强度。After dividing the image frame into a plurality of first sub-images, the classifying unit 101 calculates a motion vector value of each of the first sub-images, and pairs the motion vector values of each of the first sub-images The first sub-image is classified, that is, the plurality of first sub-images are classified according to a vector value interval in which the motion vector value of each of the first sub-images is located. Among them, those skilled in the art can understand that the motion vector value can directly reflect the fluctuation strength of the image.
需要说明的是,在视频编码中,运动图像邻近图像帧的图像内容存在时域相关性。本实施例中,分类单元101对每个所述第一子图像作运动补偿,在所述图像帧的相邻图像帧中寻找第一子图像的匹配块,并记录第一子图像的匹配块的运动矢量MVi,j=(Δx,Δy),
Figure PCTCN2017073227-appb-000027
为运动矢量值,其中,Δx表示所述第一子图像在x轴方向的位移,Δy表示所述第一子图像在y轴方向的位移。例如,参照图2,分类单元101在t时刻的图像帧中选中一第一子图像,将在t-1时刻相邻图像帧中进行最小失真搜索,获得最小失真的匹配块,并计算得出前述第一子图像和最小失真的匹配块的矢量距离,如图2中所示MV=(Δx,Δy),进而计算出选中的第一子图像的运动矢量值
Figure PCTCN2017073227-appb-000028
计算的所述图像帧的各第一子图像的运动矢量分布如图5所示。
It should be noted that in video coding, the image content of the moving image adjacent to the image frame has time domain correlation. In this embodiment, the classifying unit 101 performs motion compensation on each of the first sub-images, searches for matching blocks of the first sub-image in adjacent image frames of the image frame, and records matching blocks of the first sub-image. Motion vector MV i,j =(Δx, Δy),
Figure PCTCN2017073227-appb-000027
Is a motion vector value, where Δx represents the displacement of the first sub-image in the x-axis direction, and Δy represents the displacement of the first sub-image in the y-axis direction. For example, referring to FIG. 2, the classification unit 101 selects a first sub-image in the image frame at time t, performs minimum distortion search in the adjacent image frame at time t-1, obtains a minimum distortion matching block, and calculates The vector distance of the first sub-image and the minimum distortion matching block, as shown in FIG. 2, MV = (Δx, Δy), thereby calculating the motion vector value of the selected first sub-image
Figure PCTCN2017073227-appb-000028
The calculated motion vector distribution of each first sub-image of the image frame is as shown in FIG.
计算单元102,设置为按照与待编码的所述图像帧相同的划分方式将待编码的所述图像帧的重构图像帧划分为多个第二子图像,计算每个所述第一子图像以及每个所述第一子图像对应的第二子图像之间的均方误差;以及基于各所述均方误差计算各类第一子图像的PSNR值。The calculating unit 102 is configured to divide the reconstructed image frame of the image frame to be encoded into a plurality of second sub-images according to the same division manner as the image frame to be encoded, and calculate each of the first sub-images And a mean square error between the second sub-images corresponding to each of the first sub-images; and calculating a PSNR value of each of the first sub-images based on each of the mean square errors.
本领域技术人员可以理解的是,在帧间预测编码中,编码的下一帧基于当前帧的重构帧进行编码。在本实施例中,计算单元102按照与待编码的所述图像帧相同的划分方式将待编码的所述图像帧的重构图像帧划分为多个第 二子图像,计算每个所述第一子图像以及每个所述第一子图像对应的第二子图像之间的均方误差,其中,所述第一子图像与其对应的第二子图像之间的均方误差
Figure PCTCN2017073227-appb-000029
表示第一子图像的标准方差,
Figure PCTCN2017073227-appb-000030
表示第二子图像标准方差。
It will be understood by those skilled in the art that in inter prediction coding, the next frame of coding is encoded based on the reconstructed frame of the current frame. In this embodiment, the calculating unit 102 divides the reconstructed image frame of the image frame to be encoded into a plurality of second sub-images according to the same division manner as the image frame to be encoded, and calculates each of the first a mean square error between a sub-image and a second sub-image corresponding to each of the first sub-images, wherein a mean square error between the first sub-image and its corresponding second sub-image
Figure PCTCN2017073227-appb-000029
Represents the standard deviation of the first sub-image,
Figure PCTCN2017073227-appb-000030
Indicates the standard deviation of the second sub-image.
在计算得到每个所述第一子图像以及各所述第一子图像对应的第二子图像之间的均方误差后,所述计算单元102首先统计每个类第一子图像的平均失真Dk=∑Di,j|k<||MVi,j||<k+1,其中,
Figure PCTCN2017073227-appb-000031
为运动矢量大小,k为整数,每个前述的矢量值区间对应一k值。
After calculating the mean square error between each of the first sub-images and the second sub-image corresponding to each of the first sub-images, the calculating unit 102 first counts the average distortion of the first sub-image of each class. D k =∑D i,j |k<||MV i,j ||<k+1, where
Figure PCTCN2017073227-appb-000031
For the motion vector size, k is an integer, and each of the aforementioned vector value intervals corresponds to a k value.
然后所述计算单元102再基于每个类第一子图像的平均失真计算每个类第一子图像的PSNR值,每个类第一子图像的PSNR值
Figure PCTCN2017073227-appb-000032
其中,bpp表示像素点灰度值用二进制表示时的位数,如在0到255灰度级表示中,bpp的取值为8。
The computing unit 102 then calculates the PSNR value of each class first sub-image based on the average distortion of each class first sub-image, and the PSNR value of each class first sub-image.
Figure PCTCN2017073227-appb-000032
Where bpp represents the number of bits when the pixel point gray value is expressed in binary, as in the 0 to 255 gray level representation, the value of bpp is 8.
实施例八Example eight
基于前述任一实施例,在本实施例中,所述目标码率调整装置还包括修正模块,设置为基于当前的网络带宽对调整后的所述目标码率进行修正,以采用修正后的目标码率进行编码。Based on any of the foregoing embodiments, in the embodiment, the target rate adjustment apparatus further includes a correction module configured to correct the adjusted target code rate based on the current network bandwidth to adopt the corrected target. The code rate is encoded.
需要说明的是,本实施例的所述网络带宽是指可供用于编码的视频传输的网络带宽,本领域技术人员可以理解的是,由于网络是动态变化的,而且也存在网络带宽被本地资源抢占的问题,因此,为确保编码的视频的传输流畅性,在本实施例中,修正模块获取当前可用的网络带宽,并基于获取的所述网络带宽对调整后的所述目标码率进行修正,以采用修正后的目标码率进行编码。It should be noted that the network bandwidth in this embodiment refers to the network bandwidth available for encoding video transmission, and those skilled in the art may understand that the network bandwidth is dynamically changed, and the network bandwidth is also local resources. The problem of preemption, therefore, in order to ensure the smoothness of the transmission of the encoded video, in this embodiment, the correction module acquires the currently available network bandwidth, and corrects the adjusted target code rate based on the acquired network bandwidth. , encoding with the corrected target bit rate.
可选地,所述修正模块通过如下方式实现基于当前的网络带宽对调整后的所述目标码率进行修正:判断当前的网络带宽是否大于调整后的所述目标码率;以及在当前的网络带宽小于调整后的所述目标码率时,将所述网络带宽作为修正后的所述目标码率。Optionally, the modifying module corrects the adjusted target code rate based on the current network bandwidth by determining whether the current network bandwidth is greater than the adjusted target code rate; and in the current network. When the bandwidth is less than the adjusted target code rate, the network bandwidth is used as the corrected target code rate.
容易理解的是,当所述网络带宽小于调整后的所述目标码率时,若采用 调整后的所述目标码率进行编码,编码后的视频数据将不能流畅的传输至目标终端,导致播放卡顿等问题,影响用户的视觉体验。因此,本实施例中,在当前的网络带宽小于调整后的所述目标码率时,所述修正模块将所述网络带宽作为修正后的所述目标码率,以确保编码后的视频数据能够流畅的传输至目标终端。It is easy to understand that when the network bandwidth is smaller than the adjusted target code rate, The adjusted target bit rate is encoded, and the encoded video data cannot be smoothly transmitted to the target terminal, resulting in problems such as playing the card and affecting the user's visual experience. Therefore, in this embodiment, when the current network bandwidth is less than the adjusted target code rate, the correction module uses the network bandwidth as the corrected target code rate to ensure that the encoded video data can be Smooth transfer to the target terminal.
本发明实施例还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机可执行指令,所述计算机可执行指令被执行时实现目标码率调整方法。The embodiment of the invention further provides a computer readable storage medium, wherein the computer readable storage medium stores computer executable instructions, and the computer executable instructions are implemented to implement a target rate adjustment method.
以上仅为本申请的可选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件(例如处理器)完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,例如通过集成电路来实现其相应功能,也可以采用软件功能模块的形式实现,例如通过处理器执行存储于存储器中的程序/指令来实现其相应功能。本申请不限制于任何特定形式的硬件和软件的结合。本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或者等同替换,而不脱离本申请技术方案的精神和范围,均应涵盖在本申请的权利要求范围当中。The above is only an alternative embodiment of the present application, and thus does not limit the scope of the patent application, and the equivalent structure or equivalent process transformation of the specification and the drawings of the present application, or directly or indirectly applied to other related technologies. The fields are all included in the scope of patent protection of this application. One of ordinary skill in the art will appreciate that all or a portion of the above steps may be performed by a program to instruct related hardware, such as a processor, which may be stored in a computer readable storage medium, such as a read only memory, disk or optical disk. Wait. Alternatively, all or part of the steps of the above embodiments may also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the above embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, executing a program stored in the memory by a processor. / instruction to achieve its corresponding function. This application is not limited to any specific combination of hardware and software. A person skilled in the art should understand that the technical solutions of the present application can be modified or equivalent, without departing from the spirit and scope of the technical solutions of the present application, and should be included in the scope of the claims of the present application.
工业实用性Industrial applicability
上述技术方案能够更准确的反映编码需要的比特,提高选取的目标码率的准确度。 The above technical solution can more accurately reflect the bits required for encoding, and improve the accuracy of the selected target bit rate.

Claims (10)

  1. 一种目标码率调整方法,所述目标码率调整方法包括:A target rate adjustment method, where the target rate adjustment method includes:
    将待编码的图像帧划分为多个第一子图像,并按照每个所述第一子图像的运动矢量值对所述多个第一子图像进行分类,计算每类第一子图像的峰值信噪比PSNR值;Dividing the image frame to be encoded into a plurality of first sub-images, and classifying the plurality of first sub-images according to motion vector values of each of the first sub-images, and calculating peak values of each of the first sub-images Signal to noise ratio PSNR value;
    计算每类第一子图像的PSNR值的平均值μ,以及计算每类第一子图像的PSNR值的标准方差σ,对σ与μ的比值采用预设修正参数修正后作为编码的波动强度;Calculating an average value μ of PSNR values of each type of first sub-image, and calculating a standard deviation σ of PSNR values of each type of first sub-image, and correcting the ratio of σ to μ as a coded fluctuation intensity by using a preset correction parameter;
    根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率,其中,所述根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率包括:Adjusting the target code rate of the code according to the magnitude relationship between the fluctuation strength and the first preset threshold, wherein the adjusting the target code rate according to the magnitude relationship between the fluctuation strength and the first preset threshold includes:
    当所述波动强度大于第一预设阈值时,增大编码的目标码率;When the fluctuation strength is greater than the first preset threshold, increasing the encoded target code rate;
    当所述波动强度小于第一预设阈值时,减小编码的目标码率。When the fluctuation strength is less than the first predetermined threshold, the encoded target code rate is reduced.
  2. 如权利要求1所述的目标码率调整方法,根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率的步骤之前,所述方法还包括:The target rate adjustment method according to claim 1, before the step of adjusting the target code rate of the code according to the magnitude relationship between the fluctuation intensity and the first preset threshold, the method further includes:
    记录当前计算的波动强度,并在记录的波动强度的数量达到第二预设阈值时,计算记录的波动强度的平均值;Recording the currently calculated fluctuation intensity, and calculating an average value of the recorded fluctuation strength when the recorded fluctuation intensity reaches the second preset threshold;
    将编码的所述波动强度更新为计算的所述平均值。The encoded wave strength is updated to the calculated average.
  3. 如权利要求1所述的目标码率调整方法,其中,所述将待编码的图像帧划分为多个第一子图像,并按照每个所述第一子图像的运动矢量值对所述多个第一子图像进行分类,计算每类第一子图像的PSNR值的步骤包括:The target rate adjustment method according to claim 1, wherein the image frame to be encoded is divided into a plurality of first sub-images, and the motion vector values of each of the first sub-images are The first sub-images are classified, and the step of calculating the PSNR value of each type of first sub-image includes:
    将待编码的图像帧划分为多个第一子图像,计算待编码的所述图像帧每个所述第一子图像相对于相邻图像帧的运动矢量值,按照每个所述第一子图像的运动矢量值所在的矢量值区间对所述多个第一子图像进行分类;Dividing the image frame to be encoded into a plurality of first sub-images, and calculating a motion vector value of each of the first sub-images of the image frame to be encoded relative to the adjacent image frames, according to each of the first sub- Sorting the plurality of first sub-images by a vector value interval in which a motion vector value of the image is located;
    按照与待编码的所述图像帧相同的划分方式将待编码的所述图像帧的重构图像帧划分为多个第二子图像,计算每个所述第一子图像以及每个所述第一子图像对应的第二子图像之间的均方误差; Decomposing the reconstructed image frame of the image frame to be encoded into a plurality of second sub-images in the same division manner as the image frame to be encoded, and calculating each of the first sub-images and each of the first a mean square error between the second sub-images corresponding to a sub-image;
    基于每个所述均方误差计算每类第一子图像的PSNR值。A PSNR value for each type of first sub-image is calculated based on each of the mean square errors.
  4. 如权利要求1-3任一项所述的目标码率调整方法,根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率的步骤之后,所述方法还包括:The target rate adjustment method according to any one of claims 1 to 3, after the step of adjusting the target code rate of the encoding according to the magnitude relationship between the fluctuation strength and the first preset threshold, the method further includes:
    基于当前的网络带宽对调整后的所述目标码率进行修正,以采用修正后的目标码率进行编码。The adjusted target code rate is corrected based on the current network bandwidth to be encoded using the corrected target code rate.
  5. 如权利要求4所述的目标码率调整方法,其中,所述基于当前的网络带宽对调整后的所述目标码率进行修正的步骤包括:The target rate adjustment method according to claim 4, wherein the step of correcting the adjusted target code rate based on the current network bandwidth comprises:
    判断当前的网络带宽是否大于调整后的所述目标码率;Determining whether the current network bandwidth is greater than the adjusted target code rate;
    在当前的网络带宽小于调整后的所述目标码率时,将所述网络带宽作为修正后的所述目标码率。When the current network bandwidth is less than the adjusted target code rate, the network bandwidth is used as the corrected target code rate.
  6. 一种目标码率调整装置,所述目标码率调整装置包括:A target rate adjustment apparatus, the target rate adjustment apparatus comprising:
    第一计算模块,设置为将待编码的图像帧划分为多个第一子图像,并按照每个所述第一子图像的运动矢量值对所述多个第一子图像进行分类,计算每类第一子图像的峰值信噪比PSNR值;a first calculating module, configured to divide the image frame to be encoded into a plurality of first sub-images, and classify the plurality of first sub-images according to motion vector values of each of the first sub-images, and calculate each Peak signal to noise ratio PSNR value of the first sub-image of the class;
    第二计算模块,设置为计算每类第一子图像的PSNR值的平均值μ,以及计算每类第一子图像的PSNR值的标准方差σ,对σ与μ的比值采用预设修正参数修正后作为编码的波动强度;a second calculating module, configured to calculate an average value μ of PSNR values of each type of first sub-image, and calculate a standard deviation σ of PSNR values of each type of first sub-image, and correct the ratio of σ to μ by using a preset correction parameter After the wave strength as the code;
    调整模块,设置为根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率,其中,所述根据所述波动强度与第一预设阈值的大小关系调整编码的目标码率包括:The adjusting module is configured to adjust the target code rate of the encoding according to the magnitude relationship between the fluctuation strength and the first preset threshold, wherein the target code rate of the encoding is adjusted according to the magnitude relationship between the fluctuation strength and the first preset threshold include:
    当所述波动强度大于第一预设阈值时,增大编码的目标码率;When the fluctuation strength is greater than the first preset threshold, increasing the encoded target code rate;
    当所述波动强度小于第一预设阈值时,减小编码的目标码率。When the fluctuation strength is less than the first predetermined threshold, the encoded target code rate is reduced.
  7. 如权利要求6所述的目标码率调整装置,所述目标码率调整装置还包括:The target rate adjustment apparatus according to claim 6, wherein the target rate adjustment apparatus further comprises:
    记录模块,设置为记录当前计算的波动强度,并在记录的波动强度的数量达到第二预设阈值时,计算记录的波动强度的平均值; a recording module configured to record the currently calculated fluctuation intensity, and calculate an average value of the recorded fluctuation strength when the recorded fluctuation intensity reaches a second preset threshold;
    更新模块,设置为将编码的所述波动强度更新为计算的所述平均值。An update module is arranged to update the encoded wave strength to the calculated average.
  8. 如权利要求6所述的目标码率调整装置,其中,所述第一计算模块包括:The target rate adjustment apparatus of claim 6, wherein the first calculation module comprises:
    分类单元,设置为将待编码的图像帧划分为多个第一子图像,计算待编码的所述图像帧每个所述第一子图像相对于相邻图像帧的运动矢量值,按照每个所述第一子图像的运动矢量值所在的矢量值区间对所述多个第一子图像进行分类;a classifying unit configured to divide the image frame to be encoded into a plurality of first sub-images, and calculate a motion vector value of each of the first sub-images relative to the adjacent image frames of the image frame to be encoded, according to each Sorting the plurality of first sub-images by a vector value interval in which the motion vector value of the first sub-image is located;
    计算单元,设置为按照与待编码的所述图像帧相同的划分方式将待编码的所述图像帧的重构图像帧划分为多个第二子图像,计算每个所述第一子图像以及每个所述第一子图像对应的第二子图像之间的均方误差;以及基于每个所述均方误差计算每个各类第一子图像的PSNR值。a calculating unit, configured to divide the reconstructed image frame of the image frame to be encoded into a plurality of second sub-images in the same division manner as the image frame to be encoded, and calculate each of the first sub-images and a mean square error between the second sub-images corresponding to each of the first sub-images; and calculating a PSNR value for each of the first sub-images based on each of the mean square errors.
  9. 如权利要求6-8任一项所述的目标码率调整装置,所述目标码率调整装置还包括:The target rate adjustment apparatus according to any one of claims 6 to 8, wherein the target rate adjustment apparatus further comprises:
    修正模块,设置为基于当前的网络带宽对调整后的所述目标码率进行修正,以采用修正后的目标码率进行编码。The correction module is configured to correct the adjusted target code rate based on the current network bandwidth to encode using the corrected target code rate.
  10. 如权利要求9所述的目标码率调整装置,其中,所述修正模块通过如下方式实现基于当前的网络带宽对调整后的所述目标码率进行修正:The target rate adjustment apparatus according to claim 9, wherein the correction module corrects the adjusted target code rate based on the current network bandwidth by:
    判断当前的网络带宽是否大于调整后的所述目标码率;以及在当前的网络带宽小于调整后的所述目标码率时,将所述网络带宽作为修正后的所述目标码率。 Determining whether the current network bandwidth is greater than the adjusted target code rate; and when the current network bandwidth is less than the adjusted target code rate, using the network bandwidth as the corrected target code rate.
PCT/CN2017/073227 2016-02-15 2017-02-10 Method and device for adjusting target code rate WO2017140230A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610086704.4 2016-02-15
CN201610086704.4A CN107087192A (en) 2016-02-15 2016-02-15 Target bit rate method of adjustment and device

Publications (1)

Publication Number Publication Date
WO2017140230A1 true WO2017140230A1 (en) 2017-08-24

Family

ID=59614136

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/073227 WO2017140230A1 (en) 2016-02-15 2017-02-10 Method and device for adjusting target code rate

Country Status (2)

Country Link
CN (1) CN107087192A (en)
WO (1) WO2017140230A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110166781A (en) * 2018-06-22 2019-08-23 腾讯科技(深圳)有限公司 A kind of method for video coding, device and readable medium
CN111447339A (en) * 2020-03-26 2020-07-24 西安万像电子科技有限公司 Image transmission method and system
CN111787336A (en) * 2019-04-04 2020-10-16 杭州海康威视数字技术股份有限公司 Code rate switching method and device
CN113315773A (en) * 2021-05-31 2021-08-27 浙江大华技术股份有限公司 Code rate adjusting method and device, electronic equipment and storage medium

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109344278B (en) * 2018-09-25 2020-08-14 北京邮电大学 Visual search method, device and equipment
CN111726656B (en) * 2020-07-20 2022-07-26 有半岛(北京)信息科技有限公司 Transcoding method, device, server and storage medium of live video
CN113099241B (en) * 2021-03-31 2022-11-01 北京百度网讯科技有限公司 Reference frame list updating method, device, equipment and storage medium
CN114401404B (en) * 2022-03-24 2022-07-26 深圳比特微电子科技有限公司 VPU (virtual private Unit) coding strategy implementation method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020168007A1 (en) * 2001-04-19 2002-11-14 Sarnoff Corporation Apparatus and method for allocating bits temporaly between frames in a coding system
CN101094411A (en) * 2007-07-03 2007-12-26 芯瀚电子技术(上海)有限公司 Code rate control method of video code
EP1944980A2 (en) * 2007-01-10 2008-07-16 Koninklijke Philips Electronics N.V. Bit rate control algorithm
CN102223524A (en) * 2010-04-13 2011-10-19 中兴通讯股份有限公司 Stereoscopic wavelet video coding frame grouping method and device
CN104065962A (en) * 2013-10-28 2014-09-24 四川大学 Macroblock layer bit allocation optimization method based on visual attention

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020168007A1 (en) * 2001-04-19 2002-11-14 Sarnoff Corporation Apparatus and method for allocating bits temporaly between frames in a coding system
EP1944980A2 (en) * 2007-01-10 2008-07-16 Koninklijke Philips Electronics N.V. Bit rate control algorithm
CN101094411A (en) * 2007-07-03 2007-12-26 芯瀚电子技术(上海)有限公司 Code rate control method of video code
CN102223524A (en) * 2010-04-13 2011-10-19 中兴通讯股份有限公司 Stereoscopic wavelet video coding frame grouping method and device
CN104065962A (en) * 2013-10-28 2014-09-24 四川大学 Macroblock layer bit allocation optimization method based on visual attention

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110166781A (en) * 2018-06-22 2019-08-23 腾讯科技(深圳)有限公司 A kind of method for video coding, device and readable medium
CN111787336A (en) * 2019-04-04 2020-10-16 杭州海康威视数字技术股份有限公司 Code rate switching method and device
CN111447339A (en) * 2020-03-26 2020-07-24 西安万像电子科技有限公司 Image transmission method and system
CN113315773A (en) * 2021-05-31 2021-08-27 浙江大华技术股份有限公司 Code rate adjusting method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN107087192A (en) 2017-08-22

Similar Documents

Publication Publication Date Title
WO2017140230A1 (en) Method and device for adjusting target code rate
US11277562B2 (en) Image stabilization using machine learning
EP3488388B1 (en) Video processing method and apparatus
US10499056B2 (en) System and method for video processing based on quantization parameter
CN110876060B (en) Code rate adjusting method and device in coding process
US20130027568A1 (en) Support vector regression based video quality prediction
US8401311B2 (en) Image processing device, method, and program
US9606636B2 (en) Optical processing apparatus, light source luminance adjustment method, and non-transitory computer readable medium thereof
US12022096B2 (en) Human visual system adaptive video coding
US10536696B2 (en) Image encoding device and image encoding method
CN114302226B (en) Intelligent cutting method for video picture
CN111050169B (en) Method and device for generating quantization parameter in image coding and terminal
CN112655212A (en) Video coding optimization method and device and computer storage medium
CN109219960B (en) Method, device and equipment for optimizing video coding quality smoothness and storage medium
US20230388511A1 (en) Perceptually-aware Online Per-title Encoding for Live Video Streaming
US20210075843A1 (en) Quality Metadata Signaling for Dynamic Adaptive Streaming of Video
US10897619B2 (en) Complexity control of video codec
US11825088B2 (en) Adaptively encoding video frames based on complexity
KR20140101745A (en) Video quality measurement considering multiple artifacts
JP4410039B2 (en) Motion detection device, motion detection method, and image processing device
US11622118B2 (en) Determination of coding modes for video content using order of potential coding modes and block classification
US10848772B2 (en) Histogram-based edge/text detection
US20240357138A1 (en) Human visual system adaptive video coding
JP2018152793A (en) Image processing device, control method thereof, program, and storage medium
CN114143188A (en) Video processing method and device, electronic equipment and 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: 17752662

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

Country of ref document: EP

Kind code of ref document: A1