WO2020150992A1 - 码率分配的方法与装置 - Google Patents

码率分配的方法与装置 Download PDF

Info

Publication number
WO2020150992A1
WO2020150992A1 PCT/CN2019/073139 CN2019073139W WO2020150992A1 WO 2020150992 A1 WO2020150992 A1 WO 2020150992A1 CN 2019073139 W CN2019073139 W CN 2019073139W WO 2020150992 A1 WO2020150992 A1 WO 2020150992A1
Authority
WO
WIPO (PCT)
Prior art keywords
code rate
image
image slice
component
rate
Prior art date
Application number
PCT/CN2019/073139
Other languages
English (en)
French (fr)
Inventor
赵文军
郝开元
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to CN201980005237.XA priority Critical patent/CN111279697A/zh
Priority to PCT/CN2019/073139 priority patent/WO2020150992A1/zh
Publication of WO2020150992A1 publication Critical patent/WO2020150992A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • 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/156Availability of hardware or computational resources, e.g. encoding based on power-saving criteria
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/174Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a slice, e.g. a line of blocks or a group of blocks
    • 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/189Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding
    • H04N19/196Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding being specially adapted for the computation of encoding parameters, e.g. by averaging previously computed encoding parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/63Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using sub-band based transform, e.g. wavelets
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock

Definitions

  • This application relates to the field of video image coding, and more specifically, to a method and device for code rate allocation.
  • Bit rate control controls the output stream in video communication and streaming media transmission, so that it meets the constraints of channel bandwidth and buffer, and on this basis, minimizes the distortion of video quality as much as possible.
  • Rate control has two steps. The first step is rate allocation, and the second step is calculating quantization parameters.
  • the encoder performs encoding according to the allocated code rate and quantization parameters.
  • Bit rate allocation is an important part of the video coding process.
  • the bit rate allocated to each frame of image by bit rate allocation largely determines the quality of the coding. Judging the pros and cons of a video codec technology is to compare which video quality is better under the same bandwidth condition; or, under the same video quality condition, which occupies less network bandwidth.
  • the purpose of bit rate control is to dynamically adjust the coding parameters to ensure that the compressed video stream can be transmitted in real time through a fixed bandwidth channel under the premise of ensuring a certain image quality, or to meet the requirements of the compressed bit stream file within a specific time To be smaller than a certain specified size constraint.
  • the part related to rate control (also called compression rate control) divides an entire image into several image slices for processing.
  • the JPEG2000 standard distributes the code rate equally to each image slice. The visual effect of the reconstructed image after encoding is difficult to satisfy.
  • the present application provides a method and device for code rate allocation, which can effectively improve the visual effect of coded images.
  • a method for rate allocation includes: acquiring a first image slice in an image frame, the image frame is divided into a plurality of image slices; according to the complexity of the first image slice and the compression of the image frame After the total bit rate, calculate the preset bit rate of the first image piece; modify the preset bit rate of the first image piece by the first reference bit rate to make it close to the first reference bit rate, and obtain the allocation of the first image piece
  • the code rate, the first reference code rate is determined according to the average value of the preset code rates of at least some image slices in the image frame.
  • the preset bit rate of the image slice is obtained by the image complexity, and the preset bit rate of the image slice is corrected by the average value of the preset bit rates of at least some of the image slices in the image frame. Therefore, the solution provided by the present application can improve the rationality of the code rate allocation of image slices, and further can improve the PSNR value and visual effect of the reconstructed image.
  • a method for rate allocation includes: obtaining the allocated bit rate of an image slice; and obtaining the rate allocation weight of each image slice component of the image slice according to the sensitivity of the human eye to the image component, wherein , The sum of the code rate distribution weights of at least one image slice component is greater than the sum of the code rate distribution weights of the remaining image slice components; calculate each image according to the distribution code rate of the image slice and the code rate distribution weight of each image slice component Distribution of slice components.
  • the assigned code rate of the image slice component is obtained based on the sensitivity of the human eye to the image slice component. In other words, for the image slice component with higher human eye sensitivity, the assigned code rate is greater than The bit rate assigned to the image that is less sensitive to the human eye. Therefore, the solution provided by this application can make the encoded image obtain better subjective visual effects.
  • a method for rate allocation includes: obtaining the allocated rate of the first image chip component in the image slice; performing discrete wavelet transform on the first image slice component to obtain the resolution of the first image slice component Rate level; determine the proportion of the bit rate of each resolution level of the first image slice component in the assigned bit rate of the first image slice component; according to the assigned bit rate of the first image slice component, the first image slice component
  • the code rate occupied by the coded resolution level, the code rate of each resolution level of the first image slice component in the distribution code rate of the first image slice component, the first image slice component has been coded
  • the weight of the code rate of the resolution level in the assigned code rate of the first image slice component is calculated, and the assigned code rate of each resolution level in the first image slice component is calculated.
  • the code rate is allocated to each resolution level, where the code rate for allocation is dynamically updated as the encoding progresses, that is, for allocation
  • the code rate is equal to the total code rate minus the code rate occupied by the encoded resolution level. Therefore, the solution provided by the present application can effectively reduce the data accumulation between tier1 encoding and tier encoding, thereby effectively reducing the space and hardware overhead required for storing intermediate calculation data, and can reduce the amount of calculation and time consumption of encoding as a whole. Improve coding efficiency.
  • an encoding device is provided, and the encoding device is configured to execute the method provided in the first aspect, or the second or third aspect.
  • an image processing device in a fifth aspect, includes a memory and a processor, the memory is used to store instructions, the processor is used to execute the instructions stored in the memory, and the execution of the instructions stored in the memory causes the processor to execute the first One aspect, the second aspect, or the third aspect provides a method.
  • a computer-readable storage medium is provided, and a computer program is stored thereon.
  • the computer program When the computer program is executed by a computer, the computer realizes the method provided in the first aspect, the second aspect, or the third aspect.
  • a computer program product containing instructions is provided.
  • the instructions When the instructions are executed by a computer, the computer realizes the method provided in the first aspect, the second aspect, or the third aspect.
  • Figure 1 is a schematic block diagram of the JPEG2000 image encoding process.
  • FIG. 2 is a schematic flowchart of a method for code rate allocation provided in an embodiment of the present application.
  • Fig. 3 is a schematic diagram of filling an image frame and dividing the image frame into image blocks.
  • Figure 4 is a schematic diagram of four image components of an image.
  • FIG. 5 is a schematic flowchart of a code rate allocation method provided by another embodiment of the present application.
  • FIG. 6 is a schematic flowchart of a code rate allocation method provided by still another embodiment of the present application.
  • FIG. 7 is a schematic diagram of the resolution level obtained after the discrete wavelet transform is performed on the image slice components.
  • FIG. 8 is a schematic flowchart of a code rate allocation method provided by still another embodiment of the present application.
  • Fig. 9 is a schematic block diagram of an encoding device provided by an embodiment of the present application.
  • FIG. 10 is a schematic block diagram of an encoding device provided by another embodiment of the present application.
  • FIG. 11 is a schematic block diagram of an encoding device provided by still another embodiment of the present application.
  • FIG. 12 is a schematic block diagram of an image processing device provided by an embodiment of the present application.
  • the core of the JPEG2000 technology is the discrete wavelet transform and the rate-distortion optimization interception embedded code block coding algorithm (Embedded Block Coding with Optimized Truncation, EBCOT).
  • the basic structure of the JPEG2000 algorithm is shown in Figure 1.
  • the basic process includes: segmenting a large image to obtain multiple tiles (Tile), each of which is independently coded; performing level (DC) shift to prevent data overflow ; Carry out Discrete Wavelet Transformation (DWT) to facilitate image compression; Carry out quantization; Carry out EBCOT algorithm, EBCOT algorithm includes two coding steps of Tier1 and Tier2.
  • each wavelet subband is divided into smaller code blocks (such as 64*64), and Tier coding is performed independently in units of Code-Blocks.
  • FIG. 2 is a schematic flowchart of a method 200 for code rate allocation according to an embodiment of the application.
  • the method 200 includes the following steps.
  • the preset code rate of the first image slice is corrected by the first reference code rate, so that the difference between the code rate after correction and the first reference code rate is smaller than the difference between the code rate before correction and the first reference code rate value.
  • the first reference code rate may be determined according to the average value of the preset code rates of all image slices in the image frame.
  • the first reference code rate is equal to the average of the preset code rates of all image slices in the image frame, that is, the first reference code rate is equal to the ratio of the compressed total code rate of the image frame to the total number of image slices in the image frame.
  • the first reference code rate may also be determined according to the average value of the preset code rates of some image slices in the image frame.
  • step 230 encoding can be performed according to the allocated code rate of the first image slice.
  • the embodiment of the present application obtains the preset code rate of the first image piece based on the complexity of the first image piece. It should be understood that obtaining the preset code rate of the image piece based on the complexity of the image can achieve targeted targeting of different areas of the image frame. Allocating the bit rate helps to improve the visual effect.
  • the embodiment of the present application uses the average value of the preset bit rates of at least some of the image slices in the image frame to correct the preset bit rate of the first image slice, so as to improve the allocation rate of the first image slice. rationality.
  • the embodiment of the present application obtains the preset bit rate of the first image slice through the image complexity, and uses the average value of the preset bit rates of at least part of the image slices in the image frame to calculate the preset bit rate of the first image slice.
  • the correction can improve the rationality of the allocated code rate, and further improve the peak signal to noise ratio (PSNR) value and visual effect of the reconstructed image.
  • PSNR peak signal to noise ratio
  • this embodiment takes the first image slice in the image frame as an example for description. It should be understood that the remaining image slices in the image frame also perform bit rate allocation according to the method of this embodiment.
  • step 220 Obtain the complexity ratio of the first image piece, the complexity ratio of the first image piece is equal to the ratio of the complexity of the first image piece to the complexity of the image frame;
  • the preset code rate, the preset code rate of the first image slice is equal to the complexity ratio of the first image slice multiplied by the compressed total code rate of the image frame.
  • m and n are the pixel values in the first image slice respectively, and k is the serial number of the image slice component in the first image slice.
  • (tile(m,n,k) represents the complexity of the pixel (m,n) in the image slice component of the first image slice with sequence number k.
  • image complexity is the sum of the difference between its pixel value and its right and lower neighbors.
  • the image complexity of the entire first image slice is the sum of all the pixels on all the image slice components of the first image slice. The sum of the complexity of the image.
  • S represents the complexity of the first image piece
  • S ALL represents the sum of the complexity of all image pieces in the image frame to which the first image piece belongs (ie the complexity of the image frame)
  • B represents the preset compression of the image frame After the total bit rate.
  • the preset code rate of the first image slice can also be calculated in other ways, as long as it is related to the complexity of the first image slice.
  • the preset code rate of the first image slice is corrected by using the first reference code rate to make it closer to the first reference code rate, and the correction based on the first reference code rate The result is the allocated code rate of the first image slice.
  • the first reference code rate can be obtained in at least the following three ways.
  • the first reference code rate is equal to the average code rate of multiple image slices.
  • the average code rate is equal to the average of the preset code rates of all image slices in the image frame.
  • the first reference code rate is equal to the compressed total code rate of the image frame to which the first image slice belongs divided by the total number of image blocks included in the image frame.
  • B represents the preset compressed total bit rate of the image frame to which the first image piece belongs
  • M represents the total number of image pieces included in the image frame
  • the rationality of the allocated bit rate of the first image piece can be improved, and the visual effect of the reconstructed image can be improved.
  • the average bit rate mentioned in this article refers to the average of the preset bit rates of all image slices in the image frame, that is, the preset total bit rate of the image frame after compression divided by the total number of image slices in the image frame .
  • the text below Represents the average bit rate.
  • Method for obtaining the first reference bit rate 2 When the difference between the preset bit rate of the first image slice and the average bit rate of the multiple image slices exceeds the first threshold, the first reference bit rate is equal to the average bit rate; When the absolute value of the difference between the preset code rate and the average code rate of an image slice does not exceed the first threshold, the first reference code rate is equal to the preset code rate of the first image slice.
  • r represents the preset bit rate of the first image slice
  • Re represents the average bit rate
  • L1 represents the first threshold
  • the first threshold may be determined according to actual needs, or may be determined according to empirical values.
  • the first threshold when it is necessary to limit the distance between the allocated bit rate of the image slice and the average bit rate not exceeding L1, the first threshold may be taken as L1.
  • the first reference bit rate can also be calculated according to the following formula
  • r represents the preset bit rate of the first image slice
  • a 1 and b 1 are constants
  • a 1 is greater than b 1 .
  • the first reference code rate is set as the preset code rate of the first image slice.
  • the first reference code rate is equal to the preset code rate of the first image slice, it is equivalent to not correcting the preset code rate of the first image slice.
  • Method for obtaining the first reference code rate 3) When the preset code rate of the first image piece is greater than the average code rate of the multiple image pieces, the first reference code rate is equal to the preset code rate of the multiple image pieces and is greater than the average code rate The average value of the preset bit rate of the image slices with a high rate; when the preset bit rate of the first image slice is less than the average bit rate, the first reference bit rate is equal to the image with the preset bit rate less than the average bit rate among multiple image slices The average value of the preset code rate of the slice; when the preset code rate of the first image slice is equal to the average code rate, the first reference code rate is equal to the average code rate.
  • r represents the preset bit rate of the first image slice
  • a reference bit rate greater than the average bit rate is used for correction, and for image slices with a preset bit rate less than the average bit rate, a lower than average bit rate is used.
  • the reference code rate is corrected, and the reference code rate equal to the average code rate is used for correction for image slices whose preset code rate is equal to the average code rate.
  • the allocated code rate of the first image slice is equal to the product of the preset code rate of the first image slice and the first correction factor, where the first correction factor is based on the first image
  • the ratio of the preset code rate of the slice to the first reference code rate is determined.
  • r represents the preset bit rate of the first image slice
  • x is a negative number whose absolute value is less than 1. For example, x is equal to -0.2.
  • the first reference code rate in equation (7) It can be obtained by any of the methods 1), 2), and 3) for obtaining the first reference code rate described above.
  • the preset code rate of the first image slice is corrected once to obtain the allocated code rate of the first image slice. In some cases, the preset code rate of the first image slice may also be corrected two or more times to obtain the allocated code rate of the first image slice.
  • the first reference code rate is used to correct the preset code rate of the first image slice so that it is close to the first reference code rate to obtain the corrected code rate of the first image slice, wherein the first reference code rate is based on at least part of the image frame
  • the average value of the preset bit rate of the image slice is determined.
  • the second reference code rate is used to continue to correct the corrected code rate of the first image slice so that it approaches the second reference code rate to obtain the allocated code rate of the first image slice.
  • the first reference code rate can be obtained by any of the methods 1), 2), and 3) of obtaining the first reference code rate described above.
  • the method for acquiring the second reference code rate may include the following two.
  • the second reference code rate is equal to the average code rate.
  • the second reference code rate acquisition method 2) When the absolute value of the difference between the corrected code rate and the average code rate of the first image piece exceeds the second threshold, the second reference code rate is equal to the average code rate; when the first image piece When the absolute value of the difference between the corrected code rate and the average code rate does not exceed the second threshold, the second reference code rate is equal to the corrected code rate of the first image slice.
  • the second reference bit rate can be calculated according to the following formula
  • r′ represents the modified bit rate of the first image slice
  • Re represents the average bit rate
  • L2 represents the second threshold
  • the second threshold may be determined according to actual needs, or may be determined according to empirical values.
  • the second threshold when it is necessary to limit the distance between the allocated bit rate of the image slice and the average bit rate not exceeding L2, the second threshold may be taken as L2.
  • the second threshold is smaller than the first threshold, that is, L2 ⁇ L1 .
  • the second reference bit rate can also be calculated according to the following formula
  • r′ represents the modified bit rate of the first image slice
  • a 2 and b 2 are constants
  • a 2 is greater than b 2 .
  • the allocated code rate of the first image slice is equal to the product of the correction code rate of the first image slice and the second correction factor, where the second correction factor is based on the first image slice.
  • the ratio of the modified code rate to the second reference code rate is determined.
  • the correction code rate of the first image piece is equal to the product of the preset code rate of the first image piece and the first correction factor, where the first correction factor is based on the ratio of the preset code rate of the first image piece to the first reference code rate determine.
  • the allocation code rate R of the first image slice can be calculated according to the following formula (10):
  • r′ represents the modified bit rate of the first image slice, Indicates the second reference bit rate, Represents the second correction factor, r represents the preset bit rate of the first image slice, Indicates the first reference bit rate, Indicates the first correction factor.
  • x and y are negative numbers whose absolute value is less than 1. For example, x is equal to -0.2 or -0.25. y is equal to -0.2.
  • the first reference code rate in equation (10) It can be obtained by any of the methods 1), 2), and 3) for obtaining the first reference code rate described above.
  • the second reference code rate It can be obtained by any of the methods 1) and 2) for obtaining the second reference code rate described above.
  • step 230 takes the second implementation manner of step 230 as an example to give a specific example.
  • step 230 includes the following two steps.
  • the first step is to correct the preset code rate r of the first image slice according to the following formula to obtain the corrected code rate r′ of the first image slice:
  • the function of x is a negative number whose absolute value is less than 1. For example, it is known through experiments that when x is equal to -0.2 or -0.25, the effect of correcting the bit rate r′ of the first image slice is better.
  • the first reference code rate is obtained through the first reference code rate obtaining method 3) described above.
  • formula (11) with The deformations of the first reference code rate under different conditions are respectively shown.
  • Represents the second correction factor, which is about The function of, y is a negative number whose absolute value is less than 1
  • a 2 and b 2 are constants
  • a 2 > b 2 b 2 .
  • y is equal to -0.2
  • a 2 is equal to 1.618
  • b 2 is equal to 0.382
  • the effect of the allocation code rate r i "of the first image slice is better.
  • the second reference code rate is acquired through the second reference code rate acquisition method 2) described above.
  • the embodiment of the present application obtains the preset code rate of the first image piece based on the complexity of the image piece, so as to realize the targeted allocation of the code rate to different areas of the image frame; by presetting at least part of the image piece in the image frame
  • the average code rate is used to correct the preset code rate of the first image slice, which can improve the rationality of the assigned code rate of the first image slice.
  • the size of the image frame is not necessarily an integer multiple of the size of the image slice to be divided, for example, the length (or width) of the image frame is not an integer multiple of the length (or width) of the image slice.
  • the size of the image frame is not an integer multiple of the size of the image slice to be divided, in the process of dividing the image frame into a plurality of image slices, it is necessary to pad the image frame.
  • the image frame before filling is recorded as the original image frame in this article.
  • the size of the filling can be divided into two cases: one-way filling and two-way filling.
  • one-way filling means that the length (or width) of the original image frame is exactly an integer multiple of the length (or width) of the image piece, and the width (or length) is not exactly an integer multiple of the width (or length) of the image piece Times.
  • unidirectional filling what needs to be filled is to subtract the width (or length) of the original image frame from the integer multiple of the width (or length) of the image slice as the length (or width), and take the width (or Length) is a wide rectangle.
  • bidirectional filling means that the length of the original image frame is not an integer multiple of the length of the image slice, and the width of the original image frame is not an integer multiple of the width of the image slice.
  • two rectangles need to be filled.
  • the first rectangle is the length of the original image frame as the length, and the width of the multiple of the image slice and the width of the original image frame as the width.
  • the second rectangle is a rectangle whose width is a multiple of the width of the image piece, and the difference between the multiple of the length of the image piece and the length of the original image frame is the length.
  • the pixel value required for filling is a gray value that meets the rules of image accuracy.
  • the filled pixel value can be half of the maximum accuracy of the image, that is, 2 ⁇ (d/2).
  • the pixel value of the image fill is selected as a constant number, although it enlarges the original image, it occupies a small bit stream compared to the original image, which is within the allowable range of the application.
  • the filled pixel value can also be selected to be 1/3 or 3/4 of the maximum accuracy of the image.
  • the size of the filling and the pixel value of the filling are determined.
  • a padding method is used to make the sizes of the divided image slices consistent, which can simplify the hardware design.
  • the PSNR value and visual effect of the reconstructed image can be improved by adopting the method of padding in the upper left corner.
  • the general flow of filling the original image frame is as follows.
  • the image can be filled in the upper left corner of the original image frame (as shown in FIG. 3a), or the image can be filled in the lower right corner of the original image frame (as shown in 3(b)).
  • the image filling is selected from the upper left corner of the original image frame, as shown in 3(a).
  • the size of the original image frame and the size of the image slice it is judged whether it is one-way filling or two-way filling. For details, please refer to the above description, so I won't repeat it here.
  • the original image frame does not need to be filled.
  • the image frame mentioned in the embodiments of the present application refers to an image frame (the original image frame or the image frame after filling) whose size is a multiple of the size of the image sheet.
  • the image frame mentioned in the embodiment of this application refers to the original image frame; when the original image frame needs to be filled, the image frame mentioned in the embodiment of this application refers to Is the image after filling.
  • the image frame in the embodiment of the present application may be an original image, and such an original image may be called a raw image.
  • Raw image means that the CMOS or CCD image sensor converts the captured light source signal into the original data of the digital signal, which mainly records the original information of the digital camera sensor.
  • the CMOS or CCD image sensor uses an RGGB format sensor array. Therefore, the raw image output by the CMOS or CCD image sensor has the RGGB color component arrangement, which is composed of a red image component (R component), a blue image component (B component) and two green image components (G component) . As shown in Figure 4, the image includes one R component, two G components, and one B component.
  • R component red image component
  • B component blue image component
  • G component green image components
  • the above describes how to obtain the allocated bit rate of the image slice.
  • the image component of each image slice in the image slices can also be allocated with a bit rate.
  • the image component of the image patch is denoted as the image patch component in this article. Therefore, the image component mentioned in this article refers to the image component in a universal sense. For example, an image has three image components of red, green, and blue. The image component mentioned in this article refers to the image components included in the image. Image components.
  • the method 200 provided in the embodiment of the present application may further include: determining the code rate distribution weight of each image slice component in the first image slice; Code rate distribution weights, to obtain the distribution code rate of each image slice component.
  • the allocated code rate of each image slice component in the first image slice is obtained according to the method 500 provided in the following embodiment.
  • the allocated code rate of each image slice component in the first image slice is also possible. For example, based on the distribution component of the first image slice, the code rate of each image slice component is evenly distributed to obtain the distribution code rate of each image slice component in the first image slice.
  • the method 200 provided in the embodiment of the present application may further include: performing discrete wavelet transform on each image slice component of the first image slice, respectively Obtain the resolution level of each image slice component; calculate the allocation code rate of each resolution level of each image slice component.
  • the allocated code rate of each resolution level of each image slice component may be calculated according to the method 600 provided in the following embodiment.
  • the allocated code rate of each resolution level of each image slice component can also be calculated according to the prior art.
  • another embodiment of the present application provides a method 500 for code rate allocation.
  • the method 500 includes the following steps.
  • the method 200 provided in the above embodiment may be used to obtain the allocated code rate of the image slice.
  • the image slice in this embodiment is the first image slice in the method 200 provided in the above embodiment.
  • the allocated code rate of the image slice can also be used to obtain the allocated code rate of the image slice. For example, the total bit rate after compression of the image frame is averaged to obtain the allocated bit rate of each image slice.
  • the sum of the code rate distribution weights of at least one of the image slice components of the image slice is greater than the sum of the code rate distribution weights of the remaining image slice components.
  • the at least one image slice component may represent one image slice component or two image slice components in the image slice.
  • the weights of the bit rate distribution of each image slice of the image slice are not completely the same.
  • image slice components with a higher degree of human eye sensitivity can be assigned a larger code rate, and vice versa, a smaller code rate can be assigned.
  • Luminosity is proportional to the light intensity energy received by retinal cells, but humans have different sensitivity to light of the same intensity and different wavelengths. Generally speaking, human eyes have the greatest light intensity sensitivity to green light, so the details produced by green light waves are of more concern to humans.
  • photography technology in actual shooting, the number of photography users continues to increase, and different users pay different attention to images. Therefore, whether from the perspective of research results on the human visual system or from the perspective of the user's own photographic needs, it is unreasonable to evenly allocate the code rate of each image component of the image slice.
  • the embodiment of the present application determines the code rate distribution weight of each image slice component of the image slice according to the sensitivity of the human eye to the image component, and then assigns the weight according to the code rate of each image slice component and the distribution code rate of the image slice to obtain each image The allocated code rate of the slice component.
  • the embodiment of the present application is based on the sensitivity of human eyes to the image components to obtain the allocated code rate of each image slice component in the image slice. For example, a larger code rate is assigned to image slice components with a higher degree of human eye sensitivity, and a smaller code rate is assigned to image slice components with lower human eye sensitivity.
  • the subjective visual effect of the reconstructed image can be improved.
  • the reconstructed image mentioned in this article refers to an image restored by decoding an encoded bitstream.
  • step 520 the rate allocation weight of each image slice component is obtained, wherein the sum of the rate allocation weights of at least one image slice component is greater than the sum of the rate allocation weights of the remaining image slice components, where at least one image slice component It may be one or more image slice components with high human eye sensitivity, or it may be an image slice component that the user pays attention to.
  • the image slice includes four image slice components of red, green, green and blue (RGGB), and the sum of the rate allocation weights of the two green image slice components is greater than the sum of the rate allocation weights of the red image slice component and the blue image slice component.
  • RGGB red, green, green and blue
  • the sum of the bit rate allocation weights of the image slice components that the user pays attention to is greater than the sum of the bit rate allocation weights of the remaining image slice components.
  • the user pays attention to the red component.
  • a larger bit rate distribution weight can be assigned to the red image component.
  • the bit rate allocation weight of the red image slice component is greater than the sum of the bit rate allocation weights of the green image slice component and the blue image slice component.
  • the code rate distribution weight is determined for each image chip component, and then the weight is assigned based on the code rate of each image chip component, and the distribution code of each image chip component is calculated Rate, which can improve the subjective visual effect of the image.
  • step 520 weights are assigned to the determined code rates of the four image slice components of the image slice as follows:
  • (a 1 ,a 2 ,a 3 ,a 4 )
  • a 1 represents the code rate distribution weight of the red image slice component
  • a 2 represents the code rate distribution weight of the first green image slice component
  • a 3 represents the code rate distribution weight of the second green image slice component
  • a 4 represents The bit rate distribution weight of the blue image slice component.
  • a 2 +a 3 >a 1 +a 4 means that the sum of the weights of the bit rate distribution of the two green image slice components is greater than the sum of the weights of the bit rate distribution of the red image slice component and the blue image slice component.
  • step 520 the distribution code rate T Cj of the j-th image slice component of the image slice is obtained according to the following formula:
  • R represents the distribution code rate of the image slice
  • a j represents the code rate distribution weight of the j-th image slice component of the image slice.
  • the code rate distribution weight of each image slice component is determined based on the sensitivity weight of the human eye to different colors obtained from the study of the human visual system. This application is not limited to this, and the weight of the bit rate distribution of each image slice component can also be determined in combination with the color that humans pay attention to in the shooting task.
  • the subjective visual effect of the reconstructed image can be improved.
  • the allocated code rate of the image slice may be obtained by the method 200 provided in the foregoing embodiment.
  • the relevant description above please refer to the relevant description above, which will not be repeated here.
  • the distribution code rate of the image slice is obtained based on the image complexity, and the distribution code rate of the image slice component is obtained based on the sensitivity of the human eye to the image component, thereby further improving the subjective visual effect of the reconstructed image.
  • the allocated code rate of the image slice may also be obtained in other ways.
  • the compressed total code rate of the image frame to which the image slice belongs is averaged to obtain the allocated code rate of the image slice.
  • encoding may be performed based on the allocated code rate.
  • the method 500 provided in the embodiment of the present application may further include: performing discrete wavelet transform on each image slice component of the image slice to obtain each image separately The resolution level of the slice component; calculate the distribution code rate of each resolution level of each image slice component.
  • the allocated code rate of each resolution level of each image slice component may be calculated according to the method 600 provided in the following embodiment.
  • the allocated code rate of each resolution level of each image slice component can also be calculated according to the prior art.
  • yet another embodiment of the present application provides a method 600 for code rate allocation.
  • the method 600 includes the following steps.
  • the method 200 provided in the above embodiment may be used to obtain the allocated code rate of the image slice.
  • the image slice in this embodiment is the first image slice in the method 200 provided in the above embodiment.
  • the allocated code rate of the image slice can also be used to obtain the allocated code rate of the image slice. For example, the total bit rate after compression of the image frame is averaged to obtain the allocated bit rate of each image slice.
  • the method 500 provided in the above embodiment may be used to obtain the allocated code rate of the first image slice component in the image slice.
  • the discrete wavelet transform is performed on the first image patch component to obtain (d+1) resolution levels of the first image patch component, and d is a non-negative integer.
  • the allocated code rate of the first image slice component the code rate occupied by the encoded resolution level in the first image slice component, and the code rate of each resolution level of the first image slice component in the first image slice component.
  • the weight of the assigned code rate of an image slice component, the weight of the code rate of the encoded resolution level in the first image slice component in the assigned code rate of the first image slice component, and the calculation of the first image slice component The allocated bit rate of each resolution level in an image slice component.
  • tier1 encoding is required first, then the scan channel is filtered and truncated, and then tier2 encoding and packaging are performed.
  • tier1 encoding encodes all scan channels, which will cause tier1 encoding to take up a lot of encoding time, and many tier1 encoding processes that are not included in the final output result are performed. Due to the use of a more complex method such as the rate-distortion optimization algorithm after compression, these encoding processes take a long time and increase the amount of calculation.
  • the code rate in the tier1 encoding process, in the dimension of the resolution level, the code rate is allocated to each resolution level.
  • the code rate for allocation is dynamically updated as the encoding progresses, that is, the code rate for allocation is
  • the code rate is equal to the total code rate minus the code rate occupied by the encoded resolution levels, which can effectively reduce the data accumulation between tier1 encoding and tier encoding, thereby effectively reducing the space and space required for intermediate calculation data storage. Hardware overhead. Therefore, the solution provided by the present application can reduce the amount of calculation and time consumption of coding as a whole, and improve the coding efficiency.
  • step 620 (d+1) resolution levels of the first image slice component are obtained.
  • the proportion of the code rate of each resolution level of the first image slice component in the allocated code rate of the first image slice component may also be determined in another manner.
  • step 640 the distribution code rate r i+1 of the i+ 1th resolution level of the first image slice component is calculated according to the following formula:
  • T C represents the distribution code rate of the first image slice component
  • T C ′ represents the code rate of the resolution level that has been encoded in the first image slice component
  • W′ represents the code rate of the first image slice component. The weight of the coded resolution level in the allocated bit rate of the first image slice component.
  • the method for determining the allocation code rate of the image slice components described above in conjunction with the method 500 is a step before encoding.
  • the code rate is allocated during the encoding process.
  • the code rate for allocation is dynamically updated as the encoding progresses.
  • the allocation code rate T C of the first image slice component can be calculated by the following formula:
  • a 1 , a 2 , a 3 and a 4 represent the code rate distribution weights of the four image slice components in the image slice.
  • a 1 , a 2 , a 3 and a 4 can be obtained through the method 500 provided in the foregoing embodiment.
  • a j represents the code rate allocation weight of the first image slice component.
  • T 0 represents the allocated code stream of the image slice to which the first image slice component belongs, or represents the size of the storage space required by the coded code stream preset for the image slice.
  • T represents the code stream occupied by the coded image slice component in the image slice to which the first image slice component belongs, or represents the size of the storage space occupied by the coded image slice component in the image slice.
  • a x represents the code rate allocation weight of the image slice component to which the first image slice component belongs.
  • the size of the storage space required for the coded stream preset for the image slice component is related to the allocated code rate of the image slice component.
  • the size of the storage space required for the pre-encoded code stream for the image slice component is approximately equal to the allocated code rate of the image slice component.
  • the "allocation code rate of the first image slice component" can be replaced with "the size of the storage space required for the encoded code stream preset for the first image slice component".
  • the code rate is assigned to each resolution level, where the code rate for distribution is dynamically updated as the encoding progresses, that is, the code rate for distribution is equal to the total code rate minus The code rate of the encoded resolution level.
  • the size of the code stream generated by each image slice after tier1 encoding is fixed, and then as a goal, the code stream of each resolution level of each image slice component of the image slice is processed. Cut off. Due to the fixed memory size, it is conducive to hardware implementation.
  • the allocated code rate of the first image slice component may be obtained by the method 200 provided in the foregoing embodiment.
  • the relevant description above please refer to the relevant description above, which will not be repeated here.
  • the allocated code rate of the image slice is obtained based on the image complexity, so that the encoded image can obtain a better subjective visual effect.
  • the allocated code rate of the first image slice component may be obtained by the method 500 provided in the foregoing embodiment.
  • the relevant description above please refer to the relevant description above, which will not be repeated here.
  • the assigned bit rate of the image slice components is obtained, so that the encoded image can obtain a better subjective visual effect.
  • the assigned code rate of the first image slice component can also be obtained in other ways, for example, the assigned code rate of the image slice to which the first image slice component belongs is averaged to obtain the first image slice component The allocated bit rate.
  • the code rate is allocated to each resolution level.
  • the code rate for distribution is dynamically updated as the encoding progresses, that is, the code rate for distribution is equal to
  • the total code rate minus the code rate occupied by the encoded resolution levels can effectively reduce the data accumulation between tier1 encoding and tier encoding, thereby effectively reducing the space and hardware overhead required for intermediate arithmetic data storage. Therefore, the solution provided by the present application can reduce the calculation amount and time consumption of coding as a whole, and improve the coding efficiency.
  • FIG. 8 is a schematic diagram of a code rate allocation method 800 according to another embodiment of the application.
  • the method 800 includes the following steps.
  • the method shown in FIG. 3 can be used to segment the original image to obtain image pieces.
  • EBCOT rate-distortion optimization interception embedded code block coding algorithm
  • Step 860 includes the following steps: tier1 encoding, and using the method 600 described above, in the encoding process, the code rate of the resolution tier is dynamically allocated; tier2 encoding is performed on the tier1 encoding result.
  • the preset bit rate of the image piece is obtained by the image complexity, and the preset bit rate of the image piece is corrected by the average value of the preset bit rate of at least some of the image pieces in the image frame, so that Improving the rationality of the code rate allocation of the image slices can further improve the PSNR value and visual effect of the reconstructed image.
  • the distribution code rate of each image slice component in the image slice based on the sensitivity of the human eye to the image component the subjective visual effect of the reconstructed image can be improved.
  • the subjective visual effect of the reconstructed image can be further improved.
  • the code rate is allocated to each resolution level, where the code rate for distribution is dynamically updated as the encoding progresses, that is, the code rate for distribution is equal to the total code rate
  • this can effectively reduce the data accumulation between tier1 encoding and tier encoding, which can effectively reduce the space and hardware overhead required for intermediate computing data storage, and can reduce overall
  • the calculation amount and time-consuming of coding improves coding efficiency.
  • the code rate allocation method provided by the various embodiments in this document can be applied to the coding of the JPEG2000 image coding standard and the design and implementation of its hardware.
  • the method provided in the embodiment of the present application can be applied to a scene in which a raw image is compressed and encoded.
  • an embodiment of the present application provides an encoding device 900, and the encoding device 900 is configured to execute the method 200 in the above method embodiment.
  • the encoding device 900 includes an acquisition unit 910, a calculation unit 920, and a correction unit 930.
  • the acquiring unit 910 is configured to acquire the first image slice in the image frame, and the image frame is divided into multiple image slices.
  • the calculation unit 920 is configured to calculate the preset code rate of the first image piece according to the complexity of the first image piece and the compressed total code rate of the image frame.
  • the correcting unit 930 is configured to correct the preset bit rate of the first image slice by the first reference bit rate to make it approach the first reference bit rate to obtain the assigned bit rate of the first image slice.
  • the first reference bit rate is based on the image
  • the average value of the preset bit rate of at least part of the image slices in the frame is determined.
  • the preset bit rate of the image slice is obtained by the image complexity, and the preset bit rate of the image slice is corrected by the average value of the preset bit rates of at least some of the image slices in the image frame. Therefore, the solution provided by the present application can improve the rationality of the code rate allocation of image slices, and further can improve the PSNR value and visual effect of the reconstructed image.
  • the first reference code rate is equal to the average code rate of a plurality of image slices, where the average code rate is equal to the average of the preset code rates of all image slices in the image frame.
  • the first reference code rate is equal to the average code rate, where the average code rate
  • the first reference bit rate is equal to the first threshold.
  • the first reference bit rate is equal to the preset bit rate of the multiple image pieces that is greater than the average bit rate.
  • the average value of the preset bit rate of the image piece where the average bit rate is equal to the average value of the preset bit rate of all the image pieces in the image frame; when the preset bit rate of the first image piece is less than the average bit rate, the first The reference bit rate is equal to the average value of the preset bit rates of the image pieces whose preset bit rate is less than the average bit rate among multiple image pieces; when the preset bit rate of the first image piece is equal to the average bit rate, the first reference bit rate Equal to the average bit rate.
  • the correcting unit 930 is configured to: use the first reference bit rate to correct the preset bit rate of the first image slice so that it approaches the first reference bit rate to obtain the correction code of the first image slice Rate; use the second reference code rate to continue to modify the modified code rate of the first image slice to make it close to the second reference code rate to obtain the assigned code rate of the first image slice, and the second reference code rate is equal to the average code rate.
  • the correcting unit 930 is configured to: use the first reference bit rate to correct the preset bit rate of the first image slice so that it approaches the first reference bit rate to obtain the correction code of the first image slice Rate; use the second reference code rate to continue to correct the correction code rate of the first image slice to make it close to the second reference code rate to obtain the assigned code rate of the first image slice, where, when the correction code rate of the first image slice When the absolute value of the difference between the average bit rate and the average bit rate exceeds the second threshold, the second reference bit rate is equal to the average bit rate. When the absolute value of the difference between the corrected bit rate of the first image slice and the average bit rate does not exceed the second threshold, The second reference code rate is equal to the modified code rate of the first image slice.
  • the allocated code rate of the first image slice is equal to the product of the preset code rate of the first image slice and the first correction factor, where the first correction factor is based on the preset code of the first image slice.
  • the ratio of the rate to the first reference code rate is determined.
  • the correction unit 930 is configured to calculate the allocated code rate R i of the first image slice according to the formula (7) described above.
  • the allocated code rate of the first image slice is equal to the product of the correction code rate of the first image slice and the second correction factor, where the second correction factor is based on the correction code rate of the first image slice and The ratio of the second reference code rate is determined; where the modified code rate of the first image piece is equal to the product of the preset code rate of the first image piece and the first correction factor, wherein the first correction factor is based on the pre-set code rate of the first image piece. Let the ratio of the code rate to the first reference code rate be determined.
  • the correction unit 930 is configured to calculate the allocated code rate R i of the first image slice according to the formula (10) described above.
  • the obtaining unit 910 is further configured to obtain the code rate distribution weights of the image slice components of the first image slice according to the sensitivity of the human eye to the image components, wherein the weight of at least one image slice component is The sum of the code rate allocation weights is greater than the sum of the code rate allocation weights of the remaining image slice components; the calculation unit 920 is also used to allocate the code rate according to the first image slice and the code rate of each image slice component of the first image slice Assign weights and calculate the assigned code rate of each image slice component of the first image slice.
  • the first image slice includes four image slice components of red, green, green and blue RGGB, wherein the sum of the bit rate distribution weights of the two green image slice components is greater than the red image slice component and the blue image slice component The sum of the weights of the bit rate distribution.
  • the encoding device 900 further includes a wavelet transform unit 940 and a determination unit 950.
  • the wavelet transform unit 940 is configured to perform discrete wavelet transform on the first image slice component in the first image slice to obtain the resolution level of the first image slice component.
  • the determining unit 950 is configured to determine the proportion of the code rate of each resolution level of the first image slice component in the allocated code rate of the first image slice component.
  • the calculation unit 920 is further configured to: according to the allocated code rate of the first image slice component, the code rate of the already-encoded resolution level in the first image slice component, and the code rate of each resolution level of the first image slice component Calculate the proportion of the first image slice component’s assigned code rate, the weight of the code rate of the encoded resolution level in the first image slice component in the first image slice component’s assigned code rate, and calculate the first image The allocated bit rate of each resolution level in the slice component.
  • the wavelet transform unit 940 is configured to perform a discrete wavelet transform on the first image slice component to obtain (d+1) resolution levels of the first image slice component, where d is a non-negative integer.
  • the calculating unit 920 is configured to calculate the allocated code rate r i+1 of the i+ 1th resolution level of the first image slice component according to the formula (14) described above.
  • the image frame is obtained by filling the original image frame.
  • the filling position is at the upper left corner of the original image frame.
  • the acquisition unit 910, the calculation unit 920, the correction unit 930, the wavelet transform unit 940, and the determination unit 950 in this embodiment may all be implemented by a processor or processor-related circuits.
  • an embodiment of the present application provides another encoding device 1000, and the encoding device 1000 is configured to execute the method 500 in the above method embodiment.
  • the encoding device 1000 includes an acquiring unit 1010 and a calculating unit 1020.
  • the obtaining unit 1010 is configured to obtain the allocated code rate of the image slice.
  • the acquiring unit 1010 is further configured to acquire the rate allocation weight of each image slice component of the image slice according to the sensitivity of the human eye to the image components, wherein the sum of the rate assignment weights of at least one image slice component is greater than the other image slice components The sum of the weights of the bit rate distribution.
  • the calculating unit 1020 is configured to calculate the distribution of each image slice component according to the distribution code rate of the image slice and the code rate distribution weight of each image slice component.
  • the assigned code rate of the image slice component is obtained based on the sensitivity of the human eye to the image slice component. In other words, for the image slice component with higher human eye sensitivity, the assigned code rate is greater than The bit rate assigned to the image that is less sensitive to the human eye. Therefore, the solution provided by this application can make the encoded image obtain better subjective visual effects.
  • the image slice includes four image slice components of red, green, green and blue RGGB, and the sum of the bit rate allocation weights of the two green image slice components is greater than the bit rate allocation of the red image slice component and the blue image slice component The sum of weights.
  • the encoding device 1000 further includes a wavelet transform unit 1030 and a determining unit 1040.
  • the wavelet transform unit 1030 is configured to perform discrete wavelet transform on the first image patch component in the image patch to obtain the resolution level of the first image patch component.
  • the determining unit 1040 is configured to determine the proportion of the code rate of each resolution level of the first image slice component in the allocated code rate of the first image slice component.
  • the calculation unit 1020 is further configured to: according to the allocated code rate of the first image slice component, the code rate occupied by the encoded resolution levels in the first image slice component, and the code rate of each resolution level of the first image slice component Calculate the proportion of the first image slice component’s assigned code rate, the weight of the code rate of the encoded resolution level in the first image slice component in the first image slice component’s assigned code rate, and calculate the first image The allocated bit rate of each resolution level in the slice component.
  • the wavelet transform unit 1030 is configured to perform discrete wavelet transform on the first image slice component to obtain (d+1) resolution levels of the first image slice component, where d is a non-negative integer.
  • the calculating unit 1020 is configured to calculate the allocated code rate r i+1 of the i+ 1th resolution level of the first image slice component according to the formula (14) described above.
  • the acquisition unit 1010, the calculation unit 1020, the wavelet transform unit 1030, and the determination unit 1040 in this embodiment can all be implemented by a processor or processor-related circuits.
  • an embodiment of the present application provides another encoding device 1100, and the encoding device 1100 is configured to execute the method 600 in the above method embodiment.
  • the encoding device 1100 includes an acquisition unit 1110, a wavelet transform unit 1120, a determination unit 1130, and a calculation unit 1140.
  • the obtaining unit 1110 is configured to obtain the allocated code rate of the first image slice component in the image slice.
  • the wavelet transform unit 1120 is configured to perform discrete wavelet transform on the first image slice component to obtain the resolution level of the first image slice component.
  • the determining unit 1130 is configured to determine the proportion of the code rate of each resolution level of the first image slice component in the allocated code rate of the first image slice component.
  • the calculation unit 1140 is used to calculate the code rate of each resolution level of the first image slice component according to the allocated code rate of the first image slice component, the code rate of the already-encoded resolution level in the first image slice component, The proportion of the allocated code rate of an image slice component, the weight of the code rate of the encoded resolution level in the first image slice component in the assigned code rate of the first image slice component, calculate the first image slice The allocated bitrate of each resolution level in the component.
  • the code rate is allocated to each resolution level, where the code rate for allocation is dynamically updated as the encoding progresses, that is, for allocation
  • the code rate is equal to the total code rate minus the code rate occupied by the encoded resolution level. Therefore, the solution provided by the present application can effectively reduce the data accumulation between tier1 encoding and tier encoding, thereby effectively reducing the space and hardware overhead required for storing intermediate calculation data, and can reduce the amount of calculation and time consumption of encoding as a whole. Improve coding efficiency.
  • the wavelet transform unit 1120 is configured to perform discrete wavelet transform on the first image slice component to obtain (d+1) resolution levels of the first image slice component, where d is a non-negative integer.
  • the calculation unit 1140 is configured to calculate the allocated code rate r i+1 of the i+1 resolution level of the first image slice component according to the formula (14) described above.
  • the acquisition unit 1110, the wavelet transform unit 1120, the determination unit 1130, and the calculation unit 1140 in this embodiment may be implemented by a processor or processor-related processing circuits.
  • an embodiment of the present application also provides an image processing device 1200, which is configured to execute any of the methods provided in the above method embodiments.
  • the image processing apparatus 1200 includes a processor 1210 and a memory 1220.
  • the memory 12200 stores a computer program.
  • the processor 1210 is used to execute the computer program stored in the memory 1220, and to control the computer program stored in the memory 1220.
  • the execution of causes the processor 1210 to execute any of the methods provided in the above embodiments.
  • the image processing apparatus 1210 may further include a communication interface 1230 for signal transmission with external equipment of the image processing apparatus 1200.
  • the processor 1210 is further configured to control the communication interface 1230 to receive and/or send signals.
  • the embodiments of the present application also provide a computer storage medium on which a computer program is stored.
  • the computer program When the computer program is executed by a computer, the computer executes any method provided in the above embodiments.
  • the embodiments of the present application also provide a computer program product containing instructions, which when executed by a computer causes the computer to execute any method provided in the above embodiments.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a digital video disc (DVD)), or a semiconductor medium (for example, a solid state disk (SSD)), etc.
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.

Landscapes

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

Abstract

提供一种码率分配的方法与装置,该方法包括:获取图像帧中的第一图像片,图像帧被划分为多个图像片;根据第一图像片的复杂度以及图像帧的压缩后总码率,计算第一图像片的预设码率;通过第一基准码率修正第一图像片的预设码率,使其向第一基准码率靠近,获得第一图像片的分配码率,第一基准码率根据图像帧中至少部分图像片的预设码率的平均值确定。可以提高图像片的码率分配的合理性,进而可以提高重建图像的PSNR值和视觉效果。

Description

码率分配的方法与装置
版权申明
本专利文件披露的内容包含受版权保护的材料。该版权为版权所有人所有。版权所有人不反对任何人复制专利与商标局的官方记录和档案中所存在的该专利文件或者该专利披露。
技术领域
本申请涉及视频图像编码领域,并且更为具体地,涉及一种码率分配的方法与装置。
背景技术
码率控制在视频通信以及流媒体传输中控制着输出流,使之满足信道带宽和缓冲区的约束,在此基础上尽可能保证视频质量的失真最小。码率控制具有两个步骤,第一个步骤为码率分配,第二个步骤为计算量化参数。编码器根据分配的码率以及量化参数进行编码。
码率分配是视频编码过程的一个重要环节,码率分配对每帧图像分配的码率的多少很大程度上决定了编码质量的好坏。评判一种视频编解码技术的优劣,是比较在相同的带宽条件下,哪个视频质量更好;或者,在相同的视频质量条件下,哪个占用的网络带宽更少。码率控制的目的是,通过动态地调整编码参数,在保证一定图像质量的前提下使压缩后的视频码流能通过固定带宽的信道实时传输,或是满足特定时间内压缩后码流文件必须要小于某个规定尺寸的约束。
在网络带宽资源有限的情况下,如何平衡码率分配与视频质量的问题已经成来众多研究学者的热点问题。
在静止图像压缩的标准JPEG2000中,有关码率控制(也称为压缩率控制)的部分,会将一整幅图像分割成若干个图像片来处理,JPEG2000标准对各个图像片平均分配码率,编码后重建的图像的视觉效果很难让人满意。
发明内容
本申请提供一种码率分配的方法与装置,可以有效提高编码图像的视觉效果。
第一方面,提供一种码率分配的方法,该方法包括:获取图像帧中的第一图像片,图像帧被划分为多个图像片;根据第一图像片的复杂度以及图像帧的压缩后总码率,计算第一图像片的预设码率;通过第一基准码率修正第一图像片的预设码率,使其向第一基准码率靠近,获得第一图像片的分配码率,第一基准码率根据图像帧中至少部分图像片的预设码率的平均值确定。
在本申请提供的方案中,通过图像复杂度获得图像片的预设码率,并通过图像帧中至少部分图像片的预设码率的平均值,对图像片的预设码率进行修正。因此,本申请提供的方案可以提高图像片的码率分配的合理性,进而可以提高重建图像的PSNR值和视觉效果。
第二方面,提供一种码率分配的方法,该方法包括:获取图像片的分配码率;根据人眼对图像分量的敏感程度,获取图像片的各个图像片分量的码率分配权重,其中,至少一个图像片分量的码率分配权重之和大于其余图像片分量的码率分配权重之和;根据图像片的分配码率,以及每个图像片分量的码率分配权重,计算每个图像片分量的分配。
在本申请提供的方案中,基于人眼对图像片分量的敏感程度,来获取图像片分量的分配码率,换言之,针对人眼敏感程度较高的图像片分量,为其分配的码率大于为人眼敏感程度较低的图像程度分配的码率。因此,本申请提供的方案可以使得编码后的图像获得更好的主观视觉效果。
第三方面,提供一种码率分配的方法,该方法包括:获取图像片中第一图像片分量的分配码率;对第一图像片分量进行离散小波变换,获得第一图像片分量的分辨率层级;确定第一图像片分量的各个分辨率层级的码率在第一图像片分量的分配码率中所占的比重;根据第一图像片分量的分配码率、第一图像片分量中已经编码的分辨率层级所占的码率、第一图像片分量的各个分辨率层级的码率在第一图像片分量的分配码率中所占的比重、第一图像片分量中已经编码的分辨率层级的码率在第一图像片分量的分配码率中所占的权重,计算第一图像片分量中每个分辨率层级的分配码率。
在本申请提供的方案中,在tier1编码过程中,在分辨率层级的维度上,为各个分辨率层级分配码率,其中,供分配的码率随着编码的进行而动态更新,即供分配的码率等于总的码率减去已编码的分辨率层级所占的码率。因此,本申请提供的方案可以有效减少tier1编码与tier编码之间的数据积累,从而有效可以减小中间运算数据存储所需的空间与硬件开销,可以整体上减 少编码的计算量与耗时,提高编码效率。
第四方面,提供一种编码装置,该编码装置用于执行上述第一方面,或第二方面或第三方面提供的方法。
第五方面,提供一种图像处理装置,该图像处理装置包括存储器和处理器,存储器用于存储指令,处理器用于执行存储器存储的指令,并且对存储器中存储的指令的执行使得处理器执行第一方面、第二方面或第三方面提供的方法。
第六方面,提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被计算机执行时使得计算机实现第一方面、第二方面或第三方面提供的方法。
第七方面,提供一种包含指令的计算机程序产品,指令被计算机执行时使得计算机实现第一方面、第二方面或第三方面提供的方法。
附图说明
图1是JPEG2000图像编码过程的示意性框图。
图2是本申请实施例提供的码率分配的方法的示意性流程图。
图3是对图像帧进行填充,并将图像帧划分为图像块的示意图。
图4是图像的四个图像分量的示意图。
图5是本申请另一实施例提供的码率分配方法的示意性流程图。
图6是本申请再一实施例提供的码率分配方法的示意性流程图。
图7是对图像片分量进行离散小波变换之后得到的分辨率层级的示意图。
图8是本申请再一实施例提供的码率分配方法的示意性流程图。
图9是本申请实施例提供的编码装置的示意性框图。
图10是本申请另一实施例提供的编码装置的示意性框图。
图11是本申请再一实施例提供的编码装置的示意性框图。
图12是本申请实施例提供的图像处理装置的示意性框图。
具体实施方式
下面将结合附图,对本申请实施例中的技术方案进行描述。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技 术领域的技术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。
为了更好地理解本申请实施例的内容,下文首先介绍JPEG2000的基本原理与流程。
JPEG2000技术的核心是离散小波变换和率失真优化截取内嵌码块编码算法(Embedded Block Coding with Optimized Truncation,EBCOT)。JPEG2000算法的基本结构如图1所示,基本流程包括:对大图像进行分割处理,得到多个图像片(Tile),每个图像片独立编码;进行电平(DC)移位,防止数据溢出;进行离散小波变换(Discrete Wavelet Transformation,DWT),以便于图像压缩;进行量化;执行EBCOT算法,EBCOT算法包括Tier1和Tier2两个编码步骤。EBCOT编码时,将个小波子带划分为更小的码块(如64*64),以码块(Code-Block)为单位独立进行Tier编码。
图2为本申请一个实施例提供的码率分配的方法200的示意性流程图。该方法200包括如下步骤。
210,获取图像帧中的第一图像片,图像帧被划分为多个图像片。
220,根据所述图像帧的压缩后总码率以及所述第一图像片的复杂度,计算所述第一图像片的预设码率。
230,通过第一基准码率修正第一图像片的预设码率,使其向第一基准码率靠近,获得第一图像片的分配码率,第一基准码率根据图像帧中至少部分图像片的预设码率的平均值确定。
通过第一基准码率修正第一图像片的预设码率,使得修正之后的码率与第一基准码率之间的差值小于修正之前的码率与第一基准码率之间的差值。
第一基准码率可以根据图像帧中全部图像片的预设码率的平均值确定。例如,第一基准码率等于图像帧中全部图像片的预设码率的平均值,即第一基准码率等于图像帧的压缩后总码率与图像帧中图像片的总数量的比值。
第一基准码率也可以根据图像帧中的部分图像片的预设码率的平均值确定。
下文将详细描述第一基准码率的获取方式。
应理解,经过上述步骤230后获得第一图像片经修正后得到的分配码率之后,就可以根据第一图像片的分配码率进行编码。
本申请实施例基于第一图像片的复杂度获得第一图像片的预设码率,应 理解,基于图像复杂度获得图像片的预设码率,可以实现对图像帧的不同区域针对性地分配码率,有助于提高视觉效果。
但是由于图像复杂度并不能准确无误地表征图像信息的真实情况,因此仅仅通过图像复杂度进行码率分配结果可能并不理想。针对这个问题,本申请实施例通过图像帧中至少部分图像片的预设码率的平均值,对第一图像片的预设码率进行修正,这样可以提高第一图像片的分配码率的合理性。
因此,本申请实施例通过图像复杂度获得第一图像片的预设码率,并通过图像帧中至少部分图像片的预设码率的平均值,对第一图像片的预设码率进行修正,从而可以提高分配码率的合理性,进而可以提高重建图像的峰值信噪比(Peak Signal to Noise Ratio,PSNR)值和视觉效果。
为了描述的简洁,本实施例以图像帧中的第一图像片为例进行描述。应理解,图像帧中的其余图像片也按照本实施例的方法进行码率分配。
作为步骤220的一种实施方式:获取第一图像片的复杂度比率,第一图像片的复杂度比率等于第一图像片的复杂度与图像帧的复杂度之比;获取第一图像片的预设码率,第一图像片的预设码率等于所述第一图像片的复杂度比率乘以所述图像帧的压缩后总码率。
例如,根据如下公式计算第一图像片的复杂度S:
S=∑ICS(tile(m,n,k))
ICS(tile(m,n,k)=|tile(m,n,k)-tile(m+1,n,k)|
+|tile(m,n,k)-tile(m,n+1,k)|    式(1)
其中,m,n分别是第一图像片中的像素值,k为第一图像片中的图像片分量的序号。(tile(m,n,k)表示第一图像片中序号为k的图像片分量中的像素(m,n)的复杂度。对于第一图像片上的每个图像片分量的每个像素点而言,它的图像复杂度就是它的像素值与它右邻、下邻的差的总和。而整个第一图像片的图像复杂度则是第一图像片所有图像片分量上所有像素点的图像复杂度的总和。
例如,根据如下公式,确定第一图像片的预设码率r:
Figure PCTCN2019073139-appb-000001
其中,S表示第一图像片的复杂度,S ALL表示第一图像片所属图像帧中所 有图像片的复杂度之和(即图像帧的复杂度),B表示为该图像帧预设的压缩后总码率。
在步骤220中,还可以通过其它方式计算第一图像片的预设码率,只要其与第一图像片的复杂度有关即可。
可选地,作为步骤230的第一种实施方式,利用第一基准码率修正第一图像片的预设码率,使其向第一基准码率靠近,将基于第一基准码率的修正结果作为第一图像片的分配码率。
第一基准码率至少可以通过如下三种方式获得。
第一基准码率的获取方式1):第一基准码率等于多个图像片的平均码率。其中,平均码率等于图像帧中全部图像片的预设码率的平均值。相当于,第一基准码率等于第一图像片所属图像帧的压缩后总码率除以该图像帧中包括的图像块的总数量。
例如,根据如下公式,计算第一基准码率
Figure PCTCN2019073139-appb-000002
Figure PCTCN2019073139-appb-000003
其中,B表示为第一图像片所属图像帧预设的压缩后总码率,M表示该图像帧中包括的图像片的总数量,
Figure PCTCN2019073139-appb-000004
表示平均码率。
因此,通过利用图像帧中各个图像片的平均码率,对第一图像片的预设码率进行修正,可以提高第一图像片的分配码率的合理性,从而可以提高重建图像的视觉效果。
本文中提及的平均码率指的是,图像帧中全部图像片的预设码率的平均值,也即为图像帧预设的压缩后总码率除以图像帧中图像片的总数量。在下文中均以
Figure PCTCN2019073139-appb-000005
表示平均码率。
第一基准码率的获取方式2):当第一图像片的预设码率与多个图像片的平均码率之差超过第一阈值时,第一基准码率等于平均码率;当第一图像片的预设码率与平均码率之差的绝对值未超过第一阈值时,第一基准码率等于第一图像片的预设码率。
可选地,根据如下公式,计算第一基准码率
Figure PCTCN2019073139-appb-000006
Figure PCTCN2019073139-appb-000007
其中,r表示第一图像片的预设码率,
Figure PCTCN2019073139-appb-000008
表示平均码率,L1表示第一阈 值。
第一阈值可以根据实际需要确定,也可以根据经验值确定。
例如,当需要限制图像片的分配码率与平均码率之间的距离不超过L1时,第一阈值可以取值为L1。
可选地,还可以根据如下公式,计算第一基准码率
Figure PCTCN2019073139-appb-000009
Figure PCTCN2019073139-appb-000010
其中,r表示第一图像片的预设码率,
Figure PCTCN2019073139-appb-000011
表示平均码率,a 1与b 1为常数,且a 1大于b 1。a 1与b 1可以根据第一阈值确定。例如,a 1=1.618,b 1=0.382。
应理解,当一个图像片的预设码率与平均码率之间的偏离程度较小时,例如,第一图像片的预设码率与平均码率之差的绝对值未超过第一阈值时,可以认为该图像片的预设码率可较为准确地表征图像信息的真实情况,因此,将该图像片的预设码率作为该图像片的分配码率,是较为合理的。所以,本实施例在第一图像片的预设码率与平均码率之差的绝对值未超过第一阈值时,将第一基准码率设置为第一图像片的预设码率。
应理解,当第一基准码率等于第一图像片的预设码率本身时,相当于不对第一图像片的预设码率进行修正。
因此,仅对预设码率偏离平均码率的程度超过第一阈值的图像片,进行预设码率的修正,对预设码率偏离平均码率的程度未超过第一阈值的图像不作修正,这样在保证码率分配的合理性的基础上,还可以提高码率分配的效果。
第一基准码率的获取方式3):当第一图像片的预设码率大于多个图像片的平均码率时,第一基准码率等于多个图像片中预设码率大于平均码率的图像片的预设码率的平均值;当第一图像片的预设码率小于平均码率时,第一基准码率等于多个图像片中预设码率小于平均码率的图像片的预设码率的平均值;当第一图像片的预设码率等于平均码率时,第一基准码率等于平均码率。
例如,根据如下公式,计算第一基准码率
Figure PCTCN2019073139-appb-000012
Figure PCTCN2019073139-appb-000013
其中,r表示第一图像片的预设码率,
Figure PCTCN2019073139-appb-000014
表示平均码率,
Figure PCTCN2019073139-appb-000015
表示多个图像片中预设码率大于平均码率的图像片的预设码率的平均值,
Figure PCTCN2019073139-appb-000016
表示多个图像片中预设码率小于平均码率的图像片的预设码率的平均值。
因此,本实施例针对预设码率大于平均码率的图像片,采用比平均码率大的基准码率进行修正,针对预设码率小于平均码率的图像片,采用比平均码率小的基准码率进行修正,针对预设码率等于平均码率的图像片,采用等于平均码率的基准码率进行修正。应理解,针对预设码率与平均码率的偏离程度不同的图像片,对其预设码率采用不同程度的修正,以获得其分配码率,可以进一步提高图像片码率分配的合理性。
应理解,上文描述的第一基准码率的获取方式1)、2)、3)仅为示例而非限定。实际应用中,可以根据具体需求赋予第一基准码率其他可行的定义。
作为示例,在步骤230的第一种实施方式中,第一图像片的分配码率等于第一图像片的预设码率与第一修正因子的乘积,其中,第一修正因子根据第一图像片的预设码率与第一基准码率的比值确定。
例如,根据如下公式,计算第一图像片的分配码率R:
Figure PCTCN2019073139-appb-000017
Figure PCTCN2019073139-appb-000018
其中,r表示第一图像片的预设码率,
Figure PCTCN2019073139-appb-000019
表示第一基准码率,
Figure PCTCN2019073139-appb-000020
表示第一修正因子,x为绝对值小于1的负数。例如,x等于-0.2。
式(7)中的第一基准码率
Figure PCTCN2019073139-appb-000021
可以由前文描述的第一基准码率的获取方式1)、2)、3)中的任一种方式获得。
在上文描述的步骤230的第一种实施方式中,对第一图像片的预设码率进行一次修正,获得第一图像片的分配码率。在一些情况下,还可以对第一图像片的预设码率进行两次或更多次的修正,以获得第一图像片的分配码率。
可选地,作为步骤230的第二种实施方式。利用第一基准码率修正第一图像片的预设码率,使其向第一基准码率靠近,获得第一图像片的修正码率,其中,第一基准码率根据图像帧中至少部分图像片的预设码率的平均值确定。利用第二基准码率继续修正第一图像片的修正码率,使其向第二基准码率靠近,获得第一图像片的分配码率。
在步骤230的第二种实施方式中,第一基准码率可以通过前文描述的第 一基准码率的获取方式1)、2)、3)中的任一种方式获得。
在步骤230的第二种实施方式中,第二基准码率的获取方式可以包括如下两种。
第二基准码率的获取方式1):第二基准码率等于平均码率。
第二基准码率的获取方式2):当第一图像片的修正码率与平均码率之差的绝对值超过第二阈值时,第二基准码率等于平均码率;当第一图像片的修正码率与平均码率之差的绝对值未超过第二阈值时,第二基准码率等于第一图像片的修正码率。
可选地,可以根据如下公式,计算第二基准码率
Figure PCTCN2019073139-appb-000022
Figure PCTCN2019073139-appb-000023
其中,r′表示第一图像片的修正码率,
Figure PCTCN2019073139-appb-000024
表示平均码率,L2表示第二阈值。
第二阈值可以根据实际需要确定,也可以根据经验值确定。
例如,当需要限制图像片的分配码率与平均码率之间的距离不超过L2时,第二阈值可以取值为L2。
例如,在步骤230的第二种实施方式中,当第一基准码率的获取方式为前文描述的第一基准码率的获取方式2)时,第二阈值小于第一阈值,即L2<L1。
可选地,还可以根据如下公式,计算第二基准码率
Figure PCTCN2019073139-appb-000025
Figure PCTCN2019073139-appb-000026
其中,r′表示第一图像片的修正码率,
Figure PCTCN2019073139-appb-000027
表示平均码率,a 2与b 2为常数,且a 2大于b 2。a 2与b 2的值可以根据第二阈值确定。例如,a 2=1.618,b 2=0.382。
应理解,上文描述的第二基准码率的获取方式1)、2)仅为示例而非限定。实际应用中,根据具体需求可以赋予第二基准码率其他可行的定义。
作为示例,在步骤230的第二种实施方式中,第一图像片的分配码率等于第一图像片的修正码率与第二修正因子的乘积,其中,第二修正因子根据第一图像片的修正码率与第二基准码率的比值确定。第一图像片的修正码率 等于第一图像片的预设码率与第一修正因子的乘积,其中,第一修正因子根据第一图像片的预设码率与第一基准码率的比值确定。
例如,可以根据如下公式(10),计算第一图像片的分配码率R:
Figure PCTCN2019073139-appb-000028
Figure PCTCN2019073139-appb-000029
Figure PCTCN2019073139-appb-000030
Figure PCTCN2019073139-appb-000031
其中,r′表示第一图像片的修正码率,
Figure PCTCN2019073139-appb-000032
表示第二基准码率,
Figure PCTCN2019073139-appb-000033
表示第二修正因子,r表示第一图像片的预设码率,
Figure PCTCN2019073139-appb-000034
表示第一基准码率,
Figure PCTCN2019073139-appb-000035
表示第一修正因子,x与y均为绝对值小于1的负数。例如,x等于-0.2或-0.25。y等于-0.2。
式(10)中的第一基准码率
Figure PCTCN2019073139-appb-000036
可以由前文描述的第一基准码率的获取方式1)、2)、3)中的任一种方式获得,第二基准码率
Figure PCTCN2019073139-appb-000037
可以由前文描述的第二基准码率的获取方式1)、2)中的任一种方式获得。
为了更好地理解,通过对第一图像片的预设码率进行修正获得第一图像片的分配码率的方案,下面以步骤230的第二种实施方式为例,给出一个具体例子。
作为示例而非限定,步骤230包括如下两个步骤。
第一步,根据如下公式,对第一图像片的预设码率r进行修正,获得第一图像片的修正码率r′:
Figure PCTCN2019073139-appb-000038
Figure PCTCN2019073139-appb-000039
其中,
Figure PCTCN2019073139-appb-000040
表示平均码率,
Figure PCTCN2019073139-appb-000041
表示多个图像片中预设码率大于平均码率的图像片的预设码率的平均值,
Figure PCTCN2019073139-appb-000042
表示多个图像片中预设码率小于平均码率的图像片的预设码率的平均值,
Figure PCTCN2019073139-appb-000043
表示第一修正因子,是关于
Figure PCTCN2019073139-appb-000044
的函数,x为绝对值小于1的负数。例如,经实验而知,当x等于-0.2或-0.25时,第一图像片的修正码率r′的效果较好。
应理解,在本例中,第一基准码率是通过前文描述的第一基准码率的获取方式3)获取的。公式(11)中的
Figure PCTCN2019073139-appb-000045
Figure PCTCN2019073139-appb-000046
分别表示了第一基准码率在不同情况下的变形。
第二步,根据如下公式,对采用式(11)获得的第一图像片的修正码率r i′继续修正,获取第一图像片的分配码率R:
Figure PCTCN2019073139-appb-000047
Figure PCTCN2019073139-appb-000048
其中,
Figure PCTCN2019073139-appb-000049
表示平均码率,
Figure PCTCN2019073139-appb-000050
的表示第二修正因子,是关于
Figure PCTCN2019073139-appb-000051
的函数,y为绝对值小于1的负数,a 2与b 2为常数,且a 2>b 2。例如,经实验而知,当y等于-0.2,a 2等于1.618,b 2等于0.382时,第一图像片的分配码率r i″的效果较好。
应理解,在本例中,第二基准码率是通过前文描述的第二基准码率的获取方式2)获取的。
如上,本申请实施例基于图像片的复杂度获得第一图像片的预设码率,从而可以实现对图像帧的不同区域针对性地分配码率;通过图像帧中至少部分图像片的预设码率的平均值,对第一图像片的预设码率进行修正,可以提高第一图像片的分配码率的合理性。
应理解,经过上述步骤230后获得第一图像片经修正的分配码率之后,就可以根据第一图像片的分配码率进行编码。
应理解,图像帧的尺寸不一定是要划分的图像片的尺寸的整数倍,例如,图像帧的长(或宽)不是图像片的长(或宽)的整数倍。
当图像帧的尺寸不是要划分的图像片的尺寸的整数倍时,在图像帧被划分为多个图像片的过程中,需要对图像帧进行填充(padding)。
为了区分填充之前的图像帧与填充之后的图像帧,本文中将填充之前的图像帧记为原图像帧。
在对原图像帧进行填充时,需要确定填充的尺寸以及填充的像素。
根据原图像帧和图像片的尺寸,确定填充的尺寸。填充的尺寸可以分为单向填充和双向填充两种情况。
单向填充的情况指的是,原图像帧的长(或宽)恰为图像片的长(或宽) 的整数倍,且宽(或长)恰不是图像片的宽(或长)的整数倍。单向填充的情况下,需要填充的是,以图像片的宽(或长)的整数倍减去原图像帧的宽(或长)为长(或宽),以原图像帧的宽(或长)为宽的矩形。
双向填充的情况指的是,原图像帧的长不是图像片的长的整数倍,且,原图像帧的宽不是图像片的宽的整数倍。双向填充的情况下,需要填充的是两个矩形。第一个矩形是以原图像帧的长为长,以图像片的宽的倍数与原图像帧的宽的差为宽的矩形。第二个矩形是以图像片的宽的倍数为宽,以图像片的长的倍数与原图像帧的长的差为长的矩形。
在对原图像帧进行填充时,需要的填充的像素值是符合图像精度规则的灰度值。
可选地,填充的像素值可以选择图像最大精度的一半,即2^(d/2)。
通过将需要填充的像素值设置为图像最大精度的一半,有利于后续小波变换。此外,也因为图像填充的像素值选取了一个常数量,所以它虽然把原图扩大了,但是相比于原图,所占的码流很小,在应用的允许范围内。
可选地,填充的像素值还可以选择为图像最大精度的1/3或3/4等。
上文描述了,在需要对原图像帧进行填充的情况下,确定填充的尺寸与填充的像素值。
此外,还需要确定填充的位置。目前有两种可行的方案,一种是在原图像帧的左上角进行填充(如图3(a)所示),一种是在原图像帧的右下角进行填充(如图3(b)所示)。
可选地,当从原图像帧的左上角开始对图像片进行编码时,选择从原图像帧的左上角开始进行图像填充,如图3(a)所示。
本申请实施例,在将原图像帧划分为图像片的过程中,采用了填充(padding)的方法,使得划分得到的图像片的尺寸一致,这样可以简化硬件的设计。
此外,本申请实施例,通过采用了左上角padding的方法,可以提升重建图像的PSNR值和视觉效果。
作为示例,在需要对原图像帧进行填充的情况下,对原图像帧进行填充的大致流程如下。
1),确定填充的位置。
例如,可以在原图像帧的左上角进行图像填充(如图3a所示),或者, 可以在原图像帧的右下角进行图像填充(如3(b)所示)。
可选地,在从原图像帧的左上角开始对图像片进行编码的情况下,选择从原图像帧的左上角开始进行图像填充,如3(a)所示。
2),计算需要填充的尺寸。
根据原图像帧的尺寸与图像片的尺寸,判断是单向填充的情况,还是双向填充的情况。具体详见上文描述,这里不再赘述。
3),确定需要填充的像素值的灰度值。
详见上文描述。
还应理解,当原图像帧的大小恰好为图像片的大小的整数倍,这种情况下,不需要对原图像帧进行填充。
需要说明的是,本申请实施例中提及的图像帧,指的是,尺寸与图像片的尺寸成倍数关系的图像帧(原图像帧或者填充之后的图像帧)。换言之,在原图像帧不需要填充的情况下,本申请实施例中提及的图像帧指的是原图像帧;在原图像帧需要填充的情况下,本申请实施例中提及的图像帧指的是填充之后的图像。
本申请实施例中的图像帧可以是原始图像,这种原始图像可以称为raw图像。raw图像指的是,CMOS或者CCD图像感应器将捕捉到的光源信号转化为数字信号的原始数据,主要记录了数码相机传感器的原始信息。
由于人眼对绿色更为敏感,CMOS或者CCD图像感应器采取的是RGGB格式的传感器阵列。因此,CMOS或者CCD图像感应器输出的raw图像具有RGGB的颜色分量排列方式,由一个红色图像分量(R分量)、一个蓝色图像分量(B分量)和两个绿色图像分量(G分量)组成。如图4所示,图像包括一个R分量,两个G分量,一个B分量。
上文描述了如何获取图像片的分配码率。在获得图像片的分配码率之后,还可以对图像片中的每个图像片的图像分量进行码率分配。
为了区分图像片的图像分量与普适意义上的图像分量,本文中将图像片的图像分量记为图像片分量。所以,本文中提及的图像分量指的是普适意义上的图像分量,例如,图像具有红色、绿色、蓝色三种图像分量,本文中提及的图像片分量指的是图像片包括的图像分量。
可选地,在获取第一图像片的分配码率之后,本申请实施例提供的方法200还可以包括:确定第一图像片中各个图像片分量的码率分配权重;按照 各个图像片分量的码率分配权重,获取各个图像片分量的分配码率。
可选地,按照下文实施例提供的方法500获取第一图像片中各个图像片分量的分配码率。
或者,也可以按照现有技术的方法获取第一图像片中各个图像片分量的分配码率。例如,基于第一图像片的分配分量,对各个图像片分量进行平均分配码率,获得第一图像片中各个图像片分量的分配码率。
可选地,在获得第一图像片中各个图像片分量的分配码率之后,本申请实施例提供的方法200还可以包括:对第一图像片的每个图像片分量进行离散小波变换,分别获得每个图像片分量的分辨率层级;计算每个图像片分量的每个分辨率层级的分配码率。
可选地,可以按照下文实施例提供的方法600计算每个图像片分量的每个分辨率层级的分配码率。
或者,也可以按照现有技术计算每个图像片分量的每个分辨率层级的分配码率。
如图5所示,本申请另一实施例提供一种码率分配的方法500。该方法500包括如下步骤。
510,获取图像片的分配码率,该图像片为根据对图像帧划分得到。
可以采用上文实施例提供的方法200获取图像片的分配码率。例如,本实施例中的图像片为上文实施例提供的方法200中的第一图像片。
或者,还可以采用现有的其他可行的方法获取图像片的分配码率。例如,对图像帧的压缩后总码率求平均,获得各个图像片的分配码率。
520,根据人眼对图像分量的敏感程度,获取该图像片中各个图像片分量的码率分配权重。
其中,该图像片的所有图像片分量中的至少一个图像片分量的码率分配权重之和大于其余图像片分量的码率分配权重之和。该至少一个图像片分量可以表示该图像片中的一个图像片分量,或两个图像片分量。
应理解,在本实施例中,该图像片的各个图像片的码率分配权重不完全相同。例如,人眼敏感程度较高的图像片分量,可以分配较大的码率,反之,分配较小的码率。
530,根据该图像片的分配码率,以及该图像片的每个图像片分量的码率分配权重,计算该图像片的每个图像片分量的分配码率。
在现有的JPEG2000标准码率控制中,没有针对图像片分量的码率分配进行控制。在图像片被压缩时,默认的情况是平均分配该图像片的各个图像片分量的码率大小,这并不符合现今复杂多变的情况。首先,根据对人类视觉系统的研究,人眼对色彩、对灰度的分辨能力在不同的情况下是不同的。人类对光色的感知是依靠视网膜细胞。圆锥细胞负责感知较弱的光度和色彩,杆状细胞仅能感知光度,不能感知颜色,但其对光的敏感度比圆锥细胞高很多。视网膜中三种圆锥细胞有重叠的频率响应曲线,但响应强度有所不同,它们分别对红,绿,蓝光有最敏感,共同决定了色彩感觉。光度正比于视网膜细胞接受到的光强度能量,但人类对相同强度不同波长的光具有不同的敏感度。一般而言,人类的眼睛对绿色光产生最大的光强敏感度,所以绿光波所产生的细节是人类较为关注的。其次,随着摄影技术的普及,在实际的拍摄中,摄影用户的数目不断增加,不同的用户对图像的关注点也不尽相同。因此,无论从对人类视觉系统的研究成果的角度,还是从用户自身的摄影需求的角度而言,对图像片的各个图像片分量进行平均分配码率是不合理的。
本申请实施例根据人眼对图像分量的敏感程度,确定图像片的各个图像片分量的码率分配权重,然后根据各个图像片分量的码率分配权重以及图像片的分配码率,获取各个图像片分量的分配码率。换言之,本申请实施例是基于人眼对图像分量的敏感程度,来获取图像片中各个图像片分量的分配码率。例如,为人眼敏感程度较高的图像片分量分配较大的码率,为人眼敏感程度较低的图像片分量分配较小的码率。
因此,本申请实施例,通过基于人眼对图像分量的敏感程度,来获取图像片中各个图像片分量的分配码率,可以提高重构图像的主观视觉效果。
应理解,本文中提及的重构图像指的是对编码后的码流进行解码恢复出的图像。
在步骤520中,获得各个图像片分量的码率分配权重,其中,至少一个图像片分量的码率分配权重之和大于其余图像片分量的码率分配权重之和,这里的至少一个图像片分量可以是人眼敏感度较高的一个或多个图像片分量,或者,可以是用户所关注的图像片分量。
例如,该图像片包括红绿绿蓝(RGGB)四个图像片分量,两个绿色图像片分量的码率分配权重之和大于红色图像片分量与蓝色图像片分量的码率分配权重之和。
再例如,用户所关注的图像片分量的码率分配权重之和大于其余图像片分量的码率分配权重之和。
例如,在某次拍摄任务中,用户关注红色分量,这种情形下,可以为红色图像片分量分配较大的码率分配权重。假设该图像片包括红绿蓝(RGGB)四个图像片分量,红色图像片分量的码率分配权重大于绿色图像片分量与蓝色图像片分量的码率分配权重之和。
因此,在本申请实施例中,根据人眼对图像分量的敏感程度,为各个图像片分量确定码率分配权重,然后基于各个图像片分量的码率分配权重,计算各个图像片分量的分配码率,这样可以提高图像的主观视觉效果。
作为示例,假设第一图像片具有四个分量RGGB。在步骤520中,为图像片的四个图像片分量确定的码率分配权重如下:
α=(a 1,a 2,a 3,a 4)
a 2+a 3>a 1+a 4
其中,a 1表示红色图像片分量的码率分配权重,a 2表示第一个绿色图像片分量的码率分配权重,a 3表示第二个绿色图像片分量的码率分配权重,a 4表示蓝色图像片分量的码率分配权重。a 2+a 3>a 1+a 4表示,两个绿色图像片分量的码率分配权重之和大于红色图像片分量与蓝色图像片分量的码率分配权重之和。
在本例中,α=(a 1,a 2,a 3,a 4)表示根据人类视觉系统研究得出的人眼对不同颜色的敏感权重而确定的各个图像片分量的码率分配权重。
假设一个图像片包括四个图像片分量RGGB,在步骤520中,根据如下公式获取该图像片的第j个图像片分量的分配码率T Cj
Figure PCTCN2019073139-appb-000052
其中,R表示为该图像片的分配码率,a j表示该图像片的第j个图像片分量的码率分配权重。
上面例子中,以根据人类视觉系统研究得出的人眼对不同颜色的敏感权重,确定各个图像片分量的码率分配权重为例进行了描述。本申请并非限定于此,还可以结合拍摄任务中人类所关注的颜色,来确定各个图像片分量的码率分配权重。
因此,本申请实施例,通过基于人眼对图像分量的敏感程度,来获取图像片中各个图像片分量的分配码率,可以提高重构图像的主观视觉效果。
可选地,在步骤510中,可以通过前文实施例提供的方法200获取该图像片的分配码率。具体描述详见上文相关描述,这里不再赘述。
因此,本实施例是基于图像复杂度获取图像片的分配码率,基于人眼对图像分量的敏感程度,来获取图像片分量的分配码率,从而可以进一步提高重构图像的主观视觉效果。
可选地,在步骤510中,还可以通过其他方式获取该图像片的分配码率。例如,对该图像片所属的图像帧的压缩后总码率求平均,获得该图像片的分配码率。
还应理解,通过步骤530获得图像片中各个图像片分量的分配码率之后,可以基于分配的码率进行编码。
可选地,在获得图像片中各个图像片分量的分配码率之后,本申请实施例提供的方法500还可以包括:对图像片的每个图像片分量进行离散小波变换,分别获得每个图像片分量的分辨率层级;计算每个图像片分量的每个分辨率层级的分配码率。
可选地,可以按照下文实施例提供的方法600计算每个图像片分量的每个分辨率层级的分配码率。
或者,也可以按照现有技术计算每个图像片分量的每个分辨率层级的分配码率。
如图6所示,本申请再一实施例提供一种码率分配的方法600。该方法600包括如下步骤。
610,获取图像片中第一图像片分量的分配码率。
可以采用上文实施例提供的方法200获取图像片的分配码率。例如,本实施例中的图像片为上文实施例提供的方法200中的第一图像片。
或者,还可以采用现有的其他可行的方法获取图像片的分配码率。例如,对图像帧的压缩后总码率求平均,获得各个图像片的分配码率。
可以采用上文实施例提供的方法500获取图像片中第一图像片分量的分配码率。
或者,还可以采用现有的其他可行的方法获取图像片中第一图像片分量的分配码率。
620,对该第一图像片分量进行离散小波变换,获得该第一图像片分量的分辨率层级。
例如,对该第一图像片分量进行离散小波变换,获得该第一图像片分量的(d+1)个分辨率层级,d为非负整数。
以d等于3为例,对第一图像片分量进行3次离散小波变换,获得这个图像片分量的4个分辨率层级,如图7所示。
630,确定该第一图像片分量的各个分辨率层级的码率在该第一图像片分量的分配码率中所占的比重。
640,根据该第一图像片分量的分配码率、该第一图像片分量中已经编码的分辨率层级所占的码率、该第一图像片分量的各个分辨率层级的码率在该第一图像片分量的分配码率中所占的比重、该第一图像片分量中已经编码的分辨率层级的码率在该第一图像片分量的分配码率中所占的权重,计算该第一图像片分量中每个分辨率层级的分配码率。
如前文结合图1所描述的,当对图像片分量完成离散小波变换(DWT)和量化后,需要先进行tier1编码,再进行筛选扫描通道并截断,之后进行tier2编码并打包。在现有的JPEG2000标准中,tier1编码是对所有的扫描通道都进行编码,这样会导致tier1编码占用了大量的编码时间,并且进行了很多没有包含在最终输出结果中的tier1编码过程。由于采用了压缩后率失真优化算法这种较为复杂的方法,使得这些编码过程又占据了很长的时间并增加了运算量。
在本申请实施例中,在tier1编码过程中,在分辨率层级的维度上,为各个分辨率层级分配码率,其中,供分配的码率随着编码的进行而动态更新,即供分配的码率等于总的码率减去已编码的分辨率层级所占的码率,这样可以有效减少tier1编码与tier编码之间的数据积累,从而有效可以减小中间运算数据存储所需的空间与硬件开销。因此,本申请提供的方案,可以整体上减少编码的计算量与耗时,提高编码效率。
例如,在步骤620中,获得该第一图像片分量的(d+1)个分辨率层级。步骤630的一种实现方式为:确定该第一图像片分量的(d+1)个分辨率层级在该第一图像片分量的分配码率中所占的比重为:ω=(W d+1,3W d×4 0,…,3W 3×4 d-3,3W 2×4 d-2,3W 1×4 d-1),其中,W 1<W 2<W 3<…<W d<3W d+1
可选地,在步骤630中,还可以通过其他方式确定该第一图像片分量的各个分辨率层级的码率在该第一图像片分量的分配码率中所占的比重。
作为示例,在步骤640中,根据如下公式计算该第一图像片分量的第i+1个分辨率层级的分配码率r i+1
Figure PCTCN2019073139-appb-000053
T C′=∑R done
W′=∑w done          式(14)
其中,T C表示该第一图像片分量的分配码率,T C′表示该第一图像片分量中已经编码的分辨率层级所占的码率,W′表示该第一图像片分量中已经编码的分辨率层级在该第一图像片分量的分配码率中所占的权重。
应理解,前文结合方法500描述的确定图像片分量的分配码率的方式是编码之前的步骤。在本实施例的方法600中,是在编码过程中分配码率,具体地,供分配的码率随编码的进行而动态更新。
假设第一图像片分量所属图像片包括四个图像片分量RGGB,可以通过如下公式计算第一图像片分量的分配码率T C
Figure PCTCN2019073139-appb-000054
T=∑T Cdone
a x=∑a done             式(15)
其中,a 1,a 2,a 3与a 4表示该图像片中四个图像片分量的码率分配权重。例如,可以通过前文实施例提供的方法500获取a 1,a 2,a 3与a 4。a j表示第一图像片分量的码率分配权重。T 0表示第一图像片分量所属图像片的分配码流,或者表示为该图像片预设的编码后码流所需的存储空间大小。T表示第一图像片分量所属图像片中已经编码过的图像片分量所占的码流,或者,表示该图像片中已经编码过的图像片分量所占的存储空间的大小。a x表示第一图像片分量所属图像片中已经编码过的图像片分量的码率分配权重。
通过式(14)和式(15)可知,本申请实施例在分辨率层级的码率控制中采用了两个负反馈,分别是分辨率层级和图像片分量之间的,以及图像片分量和图像片之间的,这样的反馈控制可以实现在编码过程中更精确地控制码率的分配。
还应理解,为图像片分量预设的编码后码流所需的存储空间大小与该图像片分量的分配码率是相关的。例如,为图像片分量预设的编码后码流所需的存储空间大小约等于该图像片分量的分配码率。基于这个假设,在本实施例中,可以将“第一图像片分量的分配码率”替换为“为第一图像片分量预设的编码后码流所需的存储空间大小”。
在本实施例中,在tier1编码过程中,为各个分辨率层级分配码率,其中,供分配的码率随着编码的进行而动态更新,即供分配的码率等于总的码率减去已编码的分辨率层级所占的码率。可以理解到,相当于,本实施例固定tier1编码后的每个图像片所产生的码流的大小,然后以此为目标,对图像片的各个图像片分量的各个分辨率层级的码流进行了截断。由于采用了固定的内存大小,从而有利于硬件的实现。
可选地,在本实施例中,第一图像片分量的分配码率可以通过上述实施例提供的方法200获得。具体描述详见上文相关描述,这里不再赘述。
应理解,基于图像复杂度获取图像片的分配码率,从而可以使得编码后的图像获得更好的主观视觉效果。
可选地,在本实施例中,第一图像片分量的分配码率可以通过上述实施例提供的方法500获得。具体描述详见上文相关描述,这里不再赘述。
基于人眼对图像分量的敏感程度,来获取图像片分量的分配码率,从而可以使得编码后的图像获得更好的主观视觉效果。
可选地,在本实施例中,第一图像片分量的分配码率还可以通过其他方式获得,例如,对第一图像片分量所属图像片的分配码率求平均,获得第一图像片分量的分配码率。
如上,本申请在tier1编码过程中,在分辨率层级的维度上,为各个分辨率层级分配码率,其中,供分配的码率随着编码的进行而动态更新,即供分配的码率等于总的码率减去已编码的分辨率层级所占的码率,这样可以有效减少tier1编码与tier编码之间的数据积累,从而有效可以减小中间运算数据存储所需的空间与硬件开销。因此,本申请提供的方案,可以整体上减少编 码的计算量与耗时,提高编码效率。
图8为本申请另一实施例提供的码率分配的方法800的示意图。该方法800包括如下步骤。
810,将原图(例如raw图像)分割为图像片,采用前文描述的方法200对各个图像片进行码率分配。
例如,可以采用如图3所示的方法对原图进行分割,获得图像片。
820,采用前文描述的方法500对图像片的图像片分量进行码率分配。
830,对每个图像片,进行电平移位。
840,对每个图像片,进行离散小波变换(DWT)。
850,对每个图像片,进行量化。
860,对每个图像片,采用率失真优化截取内嵌码块编码算法(EBCOT)进行编码,获得编码码流。
步骤860包括如下步骤:tier1编码,并且采用前文描述的方法600,在编码过程中,动态分配分辨率层级的码率;对tier1的编码结果进行tier2编码。
应理解,在编码过程中,动态分配分辨率层级的码率,相当于是对编码码流的一次粗截断。压缩后率失真优化算法可以看作是对编码码流的一次细截断。从而,本申请实施例相当于对编码码流进行了二次截断(如图8中所示),优化了计算方式,可以有效减少tier1编码与tier2编码之间的数据积累,从而有效可以减小中间运算数据存储所需的空间与硬件开销,可以整体上减少编码的计算量与耗时,提高编码效率。
在本实施例中,通过图像复杂度获得图像片的预设码率,并通过图像帧中至少部分图像片的预设码率的平均值,对图像片的预设码率进行修正,从而可以提高图像片的码率分配的合理性,进而可以提高重建图像的PSNR值和视觉效果。通过基于人眼对图像分量的敏感程度,来获取图像片中各个图像片分量的分配码率,可以提高重构图像的主观视觉效果。通过基于人眼对图像分量的敏感程度,来获取图像片中各个图像片分量的分配码率,可以进一步提高重构图像的主观视觉效果。在tier1编码过程中,在分辨率层级的维度上,为各个分辨率层级分配码率,其中,供分配的码率随着编码的进行而动态更新,即供分配的码率等于总的码率减去已编码的分辨率层级所占的码率,这样可以有效减少tier1编码与tier编码之间的数据积累,从而有效可以 减小中间运算数据存储所需的空间与硬件开销,可以整体上减少编码的计算量与耗时,提高编码效率。
本文中各个实施例提供的码率分配的方法可以适用于JPEG2000图像编码标准的编码以及其硬件的设计和实现。例如,本申请实施例提供的方法可以应用于对原始(raw)图像进行压缩编码的场景。
应理解,本文中给出的各个公式仅为示例而非限定,本领域技术人员根据本文给出的各个公式可以想到的所有变种,都落入本申请包括范围。
上文描述了本申请的方法实施例,下面描述本申请的装置实施例。应理解,装置实施例的描述与方法实施例的描述相互对应,因此,未详细描述的部分可以参见前面方法实施例。
如图9所示,本申请实施例提供一种编码装置900,该编码装置900用于执行上文方法实施例中的方法200。如图9所示,该编码装置900包括获取单元910,计算单元920和修正单元930。
获取单元910,用于获取图像帧中的第一图像片,图像帧被划分为多个图像片。
计算单元920,用于根据该第一图像片的复杂度以及图像帧的压缩后总码率,计算第一图像片的预设码率。
修正单元930,用于通过第一基准码率修正第一图像片的预设码率,使其向第一基准码率靠近,获得第一图像片的分配码率,第一基准码率根据图像帧中至少部分图像片的预设码率的平均值确定。
在本申请提供的方案中,通过图像复杂度获得图像片的预设码率,并通过图像帧中至少部分图像片的预设码率的平均值,对图像片的预设码率进行修正。因此,本申请提供的方案可以提高图像片的码率分配的合理性,进而可以提高重建图像的PSNR值和视觉效果。
可选地,作为一个实施例,第一基准码率等于多个图像片的平均码率,其中,平均码率等于图像帧中全部图像片的预设码率的平均值。
可选地,作为一个实施例,当第一图像片的预设码率与多个图像片的平均码率之差超过第一阈值时,第一基准码率等于平均码率,其中,平均码率等于图像帧中全部图像片的预设码率的平均值;当第一图像片的预设码率与平均码率之差的绝对值未超过第一阈值时,第一基准码率等于第一图像片的预设码率。
可选地,作为一个实施例,当第一图像片的预设码率大于多个图像片的平均码率时,第一基准码率等于多个图像片中预设码率大于平均码率的图像片的预设码率的平均值,其中,平均码率等于图像帧中全部图像片的预设码率的平均值;当第一图像片的预设码率小于平均码率时,第一基准码率等于多个图像片中预设码率小于平均码率的图像片的预设码率的平均值;当第一图像片的预设码率等于平均码率时,第一基准码率等于平均码率。
可选地,作为一个实施例,修正单元930用于:利用第一基准码率修正第一图像片的预设码率,使其向第一基准码率靠近,获得第一图像片的修正码率;利用第二基准码率继续修正第一图像片的修正码率,使其向第二基准码率靠近,获得第一图像片的分配码率,第二基准码率等于平均码率。
可选地,作为一个实施例,修正单元930用于:利用第一基准码率修正第一图像片的预设码率,使其向第一基准码率靠近,获得第一图像片的修正码率;利用第二基准码率继续修正第一图像片的修正码率,使其向第二基准码率靠近,获得第一图像片的分配码率,其中,当第一图像片的修正码率与平均码率之差的绝对值超过第二阈值时,第二基准码率等于平均码率,当第一图像片的修正码率与平均码率之差的绝对值未超过第二阈值时,第二基准码率等于第一图像片的修正码率。
可选地,作为一个实施例,第一图像片的分配码率等于第一图像片的预设码率与第一修正因子的乘积,其中,第一修正因子根据第一图像片的预设码率与第一基准码率的比值确定。
例如,修正单元930用于,根据前文描述的公式(7),计算第一图像片的分配码率R i
可选地,作为一个实施例,第一图像片的分配码率等于第一图像片的修正码率与第二修正因子的乘积,其中,第二修正因子根据第一图像片的修正码率与第二基准码率的比值确定;其中,第一图像片的修正码率等于第一图像片的预设码率与第一修正因子的乘积,其中,第一修正因子根据第一图像片的预设码率与第一基准码率的比值确定。
例如,修正单元930用于,根据前文描述的公式(10),计算第一图像片的分配码率R i
可选地,作为一个实施例,获取单元910还用于,根据人眼对图像分量的敏感程度,获取第一图像片的各个图像片分量的码率分配权重,其中,至 少一个图像片分量的码率分配权重之和大于其余图像片分量的码率分配权重之和;计算单元920还用于,根据第一图像片的分配码率,以及第一图像片的每个图像片分量的码率分配权重,计算第一图像片的每个图像片分量的分配码率。
可选地,作为一个实施例,第一图像片包括红绿绿蓝RGGB四个图像片分量,其中,两个绿色图像片分量的码率分配权重之和大于红色图像片分量与蓝色图像片分量的码率分配权重之和。
可选地,作为一个实施例,如图9所示,编码装置900还包括小波变换单元940和确定单元950。
小波变换单元940,用于对第一图像片中的第一图像片分量进行离散小波变换,获得第一图像片分量的分辨率层级。
确定单元950,用于确定第一图像片分量的各个分辨率层级的码率在第一图像片分量的分配码率中所占的比重。
计算单元920还用于,根据第一图像片分量的分配码率、第一图像片分量中已经编码的分辨率层级所占的码率、第一图像片分量的各个分辨率层级的码率在第一图像片分量的分配码率中所占的比重、第一图像片分量中已经编码的分辨率层级的码率在第一图像片分量的分配码率中所占的权重,计算第一图像片分量中每个分辨率层级的分配码率。
可选地,作为一个实施例,小波变换单元940用于,对第一图像片分量进行离散小波变换,获得第一图像片分量的(d+1)个分辨率层级,d为非负整数。
确定单元950用于,确定第一图像片分量的(d+1)个分辨率层级在第一图像片分量的分配码率中所占的比重为:ω=(W d+1,3W d×4 0,…,3W 3×4 d-3,3W 2×4 d-2,3W 1×4 d-1),其中,W 1<W 2<W 3<…<W d<3W d+1
例如,计算单元920用于,根据前文描述的公式(14)计算第一图像片分量的第i+1个分辨率层级的分配码率r i+1
可选地,在上述各个实施例中,图像帧为原始图像帧经过填充后得到的,当从原始图像帧的左上角开始编码时,填充的位置在原始图像帧的左上角。
应理解,本实施例中的获取单元910、计算单元920、修正单元930、 小波变换单元940和确定单元950,均可以采用处理器或处理器相关电路实现。
如图10所示,本申请实施例提供另一种编码装置1000,该编码装置1000用于执行上文方法实施例中的方法500。如图10所示,该编码装置1000包括获取单元1010和计算单元1020。
获取单元1010,用于获取图像片的分配码率。
获取单元1010还用于,根据人眼对图像分量的敏感程度,获取图像片的各个图像片分量的码率分配权重,其中,至少一个图像片分量的码率分配权重之和大于其余图像片分量的码率分配权重之和。
计算单元1020,用于根据图像片的分配码率,以及每个图像片分量的码率分配权重,计算每个图像片分量的分配。
在本申请提供的方案中,基于人眼对图像片分量的敏感程度,来获取图像片分量的分配码率,换言之,针对人眼敏感程度较高的图像片分量,为其分配的码率大于为人眼敏感程度较低的图像程度分配的码率。因此,本申请提供的方案可以使得编码后的图像获得更好的主观视觉效果。
可选地,作为一个实施例,图像片包括红绿绿蓝RGGB四个图像片分量,两个绿色图像片分量的码率分配权重之和大于红色图像片分量与蓝色图像片分量的码率分配权重之和。
可选地,作为一个实施例,如图10所示,编码装置1000还包括小波变换单元1030、确定单元1040。
小波变换单元1030,用于对图像片中的第一图像片分量进行离散小波变换,获得第一图像片分量的分辨率层级。
确定单元1040,用于确定第一图像片分量的各个分辨率层级的码率在第一图像片分量的分配码率中所占的比重。
计算单元1020还用于,根据第一图像片分量的分配码率、第一图像片分量中已经编码的分辨率层级所占的码率、第一图像片分量的各个分辨率层级的码率在第一图像片分量的分配码率中所占的比重、第一图像片分量中已经编码的分辨率层级的码率在第一图像片分量的分配码率中所占的权重,计算第一图像片分量中每个分辨率层级的分配码率。
可选地,作为一个实施例,小波变换单元1030用于,对第一图像片分量进行离散小波变换,获得第一图像片分量的(d+1)个分辨率层级,d为非 负整数。
确定单元1040用于,确定第一图像片分量的(d+1)个分辨率层级在第一图像片分量的分配码率中所占的比重为:ω=(W d+1,3W d×4 0,…,3W 3×4 d-3,3W 2×4 d-2,3W 1×4 d-1),其中,W 1<W 2<W 3<…<W d<3W d+1
例如,计算单元1020用于,根据前文描述的公式(14)计算第一图像片分量的第i+1个分辨率层级的分配码率r i+1
应理解,本实施例中的获取单元1010、计算单元1020、小波变换单元1030和确定单元1040,均可以由处理器或处理器相关电路实现。
如图11所示,本申请实施例提供另一种编码装置1100,该编码装置1100用于执行上文方法实施例中的方法600。如图11所示,该编码装置1100包括获取单元1110、小波变换单元1120、确定单元1130和计算单元1140。
获取单元1110,用于获取图像片中第一图像片分量的分配码率。
小波变换单元1120,用于对第一图像片分量进行离散小波变换,获得第一图像片分量的分辨率层级。
确定单元1130,用于确定第一图像片分量的各个分辨率层级的码率在第一图像片分量的分配码率中所占的比重。
计算单元1140,用于根据第一图像片分量的分配码率、第一图像片分量中已经编码的分辨率层级所占的码率、第一图像片分量的各个分辨率层级的码率在第一图像片分量的分配码率中所占的比重、第一图像片分量中已经编码的分辨率层级的码率在第一图像片分量的分配码率中所占的权重,计算第一图像片分量中每个分辨率层级的分配码率。
在本申请提供的方案中,在tier1编码过程中,在分辨率层级的维度上,为各个分辨率层级分配码率,其中,供分配的码率随着编码的进行而动态更新,即供分配的码率等于总的码率减去已编码的分辨率层级所占的码率。因此,本申请提供的方案可以有效减少tier1编码与tier编码之间的数据积累,从而有效可以减小中间运算数据存储所需的空间与硬件开销,可以整体上减少编码的计算量与耗时,提高编码效率。
可选地,作为一个实施例,小波变换单元1120用于,对第一图像片分量进行离散小波变换,获得第一图像片分量的(d+1)个分辨率层级,d为非 负整数。
确定单元1130用于,确定第一图像片分量的(d+1)个分辨率层级在第一图像片分量的分配码率中所占的比重为:ω=(W d+1,3W d×4 0,…,3W 3×4 d-3,3W 2×4 d-2,3W 1×4 d-1),其中,W 1<W 2<W 3<…<W d<3W d+1
例如,计算单元1140用于根据前文描述的公式(14)计算第一图像片分量的第i+1个分辨率层级的分配码率r i+1
应理解,本实施例中的获取单元1110、小波变换单元1120、确定单元1130和计算单元1140可以由处理器或处理器相关处理电路实现。
如图12所示,本申请实施例还提供一种图像处理装置1200,该图像处理装置1200用于执行上文方法实施例提供的任一种方法。如图12所示,该图像处理装置1200包括处理器1210与存储器1220,存储器12200中存储有计算机程序,处理器1210用于执行存储器1220中存储的计算机程序,并且对存储器1220中存储的计算机程序的执行使得,处理器1210执行上文实施例提供的任一方法。
可选地,如图12所示,图像处理装置1210还可以包括通信接口1230,用于与图像处理装置1200的外部设备进行信号传输。
例如,处理器1210还用于控制通信接口1230进行接收和/或发送信号。
本申请实施例还提供一种计算机存储介质,其上存储有计算机程序,计算机程序被计算机执行时使得,计算机执行上文实施例提供的任一方法。
本申请实施例还提供一种包含指令的计算机程序产品,指令被计算机执行时使得计算机执行上文实施例提供的任一方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其他任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线 (例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如数字视频光盘(digital video disc,DVD))、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (51)

  1. 一种码率分配的方法,其特征在于,包括:
    获取图像帧中的第一图像片,所述图像帧被划分为多个图像片;
    根据所述第一图像片的复杂度以及所述图像帧的压缩后总码率,计算所述第一图像片的预设码率;
    通过第一基准码率修正所述第一图像片的预设码率,使其向所述第一基准码率靠近,获得所述第一图像片的分配码率,所述第一基准码率根据所述图像帧中至少部分图像片的预设码率的平均值确定。
  2. 根据权利要求1所述的方法,其特征在于,所述第一基准码率等于所述多个图像片的平均码率,其中,所述平均码率等于所述图像帧中全部图像片的预设码率的平均值。
  3. 根据权利要求1所述的方法,其特征在于,
    当所述第一图像片的预设码率与所述多个图像片的平均码率之差超过第一阈值时,所述第一基准码率等于所述平均码率,其中,所述平均码率等于所述图像帧中全部图像片的预设码率的平均值;
    当所述第一图像片的预设码率与所述平均码率之差的绝对值未超过所述第一阈值时,所述第一基准码率等于所述第一图像片的预设码率。
  4. 根据权利要求1所述的方法,其特征在于,
    当所述第一图像片的预设码率大于所述多个图像片的平均码率时,所述第一基准码率等于所述多个图像片中预设码率大于所述平均码率的图像片的预设码率的平均值,其中,所述平均码率等于所述图像帧中全部图像片的预设码率的平均值;
    当所述第一图像片的预设码率小于所述平均码率时,所述第一基准码率等于所述多个图像片中预设码率小于所述平均码率的图像片的预设码率的平均值;
    当所述第一图像片的预设码率等于所述平均码率时,所述第一基准码率等于所述平均码率。
  5. 根据权利要求4所述的方法,其特征在于,所述通过第一基准码率修正所述第一图像片的预设码率,使其向所述第一基准码率靠近,获得所述第一图像片的分配码率,包括:
    利用所述第一基准码率修正所述第一图像片的预设码率,使其向所述第 一基准码率靠近,获得所述第一图像片的修正码率;
    利用第二基准码率继续修正所述第一图像片的修正码率,使其向所述第二基准码率靠近,获得所述第一图像片的分配码率,所述第二基准码率等于所述平均码率。
  6. 根据权利要求4所述的方法,其特征在于,所述通过第一基准码率修正所述第一图像片的预设码率,使其向所述第一基准码率靠近,获得所述第一图像片的分配码率,包括:
    利用所述第一基准码率修正所述第一图像片的预设码率,使其向所述第一基准码率靠近,获得所述第一图像片的修正码率;
    利用第二基准码率继续修正所述第一图像片的修正码率,使其向所述第二基准码率靠近,获得所述第一图像片的分配码率,其中,
    当所述第一图像片的修正码率与所述平均码率之差的绝对值超过第二阈值时,所述第二基准码率等于所述平均码率,
    当所述第一图像片的修正码率与所述平均码率之差的绝对值未超过所述第二阈值时,所述第二基准码率等于所述第一图像片的修正码率。
  7. 根据权利要求1至4中任一项所述的方法,其特征在于,所述第一图像片的分配码率等于所述第一图像片的预设码率与第一修正因子的乘积,其中,所述第一修正因子根据所述第一图像片的预设码率与所述第一基准码率的比值确定。
  8. 根据权利要求7所述的方法,其特征在于,所述获得所述第一图像片的分配码率,包括:
    根据如下公式,计算所述第一图像片的分配码率R i
    Figure PCTCN2019073139-appb-100001
    Figure PCTCN2019073139-appb-100002
    其中,r i表示所述第一图像片的预设码率,
    Figure PCTCN2019073139-appb-100003
    表示所述第一基准码率,
    Figure PCTCN2019073139-appb-100004
    表示所述第一修正因子,x为常数。
  9. 根据权利要求5或6所述的方法,其特征在于,所述第一图像片的分配码率等于所述第一图像片的修正码率与第二修正因子的乘积,其中,所述第二修正因子根据所述第一图像片的修正码率与所述第二基准码率的比值确定;
    其中,所述第一图像片的修正码率等于所述第一图像片的预设码率与第一修正因子的乘积,其中,所述第一修正因子根据所述第一图像片的预设码率与所述第一基准码率的比值确定。
  10. 根据权利要求9所述的方法,其特征在于,所述获得所述第一图像片的分配码率,包括:
    根据如下公式,计算所述第一图像片的分配码率R i
    Figure PCTCN2019073139-appb-100005
    Figure PCTCN2019073139-appb-100006
    Figure PCTCN2019073139-appb-100007
    Figure PCTCN2019073139-appb-100008
    其中,r i′表示所述第一图像片的修正码率,
    Figure PCTCN2019073139-appb-100009
    表示所述第二基准码率,
    Figure PCTCN2019073139-appb-100010
    表示所述第二修正因子,r i表示所述第一图像片的预设码率,
    Figure PCTCN2019073139-appb-100011
    表示所述第一基准码率,
    Figure PCTCN2019073139-appb-100012
    表示所述第一修正因子,x与y为常数。
  11. 根据权利要求1至10中任一项所述的方法,其特征在于,所述方法还包括:
    根据人眼对图像分量的敏感程度,获取所述第一图像片的各个图像片分量的码率分配权重,其中,至少一个图像片分量的码率分配权重之和大于其余图像片分量的码率分配权重之和;
    根据所述第一图像片的分配码率,以及所述第一图像片的每个图像片分量的码率分配权重,计算所述第一图像片的每个图像片分量的分配码率。
  12. 根据权利要求11所述的方法,其特征在于,所述第一图像片包括红绿绿蓝RGGB四个图像片分量,其中,两个绿色图像片分量的码率分配权重之和大于红色图像片分量与蓝色图像片分量的码率分配权重之和。
  13. 根据权利要求11或12所述的方法,其特征在于,所述方法还包括:
    对所述第一图像片中的第一图像片分量进行离散小波变换,获得所述第一图像片分量的分辨率层级;
    确定所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重;
    根据所述第一图像片分量的分配码率、所述第一图像片分量中已经编码 的分辨率层级所占的码率、所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重、所述第一图像片分量中已经编码的分辨率层级的码率在所述第一图像片分量的分配码率中所占的权重,计算所述第一图像片分量中每个分辨率层级的分配码率。
  14. 根据权利要求13所述的方法,其特征在于,所述对所述第一图像片分量进行离散小波变换,获得所述第一图像片分量的分辨率层级,包括:
    对所述第一图像片分量进行离散小波变换,获得所述第一图像片分量的(d+1)个分辨率层级,d为非负整数;
    所述确定所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重,包括:
    确定所述第一图像片分量的(d+1)个分辨率层级在所述第一图像片分量的分配码率中所占的比重为:ω=(W d+1,3W d×4 0,…,3W 3×4 d-3,3W 2×4 d-2,3W 1×4 d-1),其中,W 1<W 2<W 3<…<W d<3W d+1
  15. 根据权利要求14所述的方法,其特征在于,所述计算所述第一图像片分量中每个分辨率层级的分配码率,包括:
    根据如下公式计算所述第一图像片分量的第i+1个分辨率层级的分配码率r i+1
    Figure PCTCN2019073139-appb-100013
    T C′=∑R done
    W′=∑w done
    其中,T C表示所述第一图像片分量的分配码率,T C′表示所述第一图像片分量中已经编码的分辨率层级所占的码率,W′表示所述第一图像片分量中已经编码的分辨率层级在所述第一图像片分量的分配码率中所占的权重。
  16. 根据权利要求1至15中任一项所述的方法,其特征在于,所述图像帧为原始图像帧经过填充后得到的,当从所述原始图像帧的左上角开始编码时,所述填充的位置在所述原始图像帧的左上角。
  17. 一种码率控制的方法,其特征在于,包括:
    获取图像片的分配码率;
    根据人眼对图像分量的敏感程度,获取所述图像片的各个图像片分量的码率分配权重,其中,至少一个图像片分量的码率分配权重之和大于其余图像片分量的码率分配权重之和;
    根据所述图像片的分配码率,以及每个图像片分量的码率分配权重,计算所述每个图像片分量的分配。
  18. 根据权利要求17所述的方法,其特征在于,所述图像片包括红绿绿蓝RGGB四个图像片分量,两个绿色图像片分量的码率分配权重之和大于红色图像片分量与蓝色图像片分量的码率分配权重之和。
  19. 根据权利要求17或18所述的方法,其特征在于,所述方法还包括:
    对所述图像片中的第一图像片分量进行离散小波变换,获得所述第一图像片分量的分辨率层级;
    确定所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重;
    根据所述第一图像片分量的分配码率、所述第一图像片分量中已经编码的分辨率层级所占的码率、所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重、所述第一图像片分量中已经编码的分辨率层级的码率在所述第一图像片分量的分配码率中所占的权重,计算所述第一图像片分量中每个分辨率层级的分配码率。
  20. 根据权利要求19所述的方法,其特征在于,所述对所述第一图像片分量进行离散小波变换,获得所述第一图像片分量的分辨率层级,包括:
    对所述第一图像片分量进行离散小波变换,获得所述第一图像片分量的(d+1)个分辨率层级,d为非负整数;
    所述确定所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重,包括:
    确定所述第一图像片分量的(d+1)个分辨率层级在所述第一图像片分量的分配码率中所占的比重为:ω=(W d+1,3W d×4 0,…,3W 3×4 d-3,3W 2×4 d-2,3W 1×4 d-1),其中,W 1<W 2<W 3<…<W d<3W d+1
  21. 根据权利要求20所述的方法,其特征在于,所述计算所述第一图像片分量中每个分辨率层级的分配码率,包括:
    根据如下公式计算所述第一图像片分量的第i+1个分辨率层级的分配码 率r i+1
    Figure PCTCN2019073139-appb-100014
    T C′=∑R done
    W′=∑w done
    其中,T C表示所述第一图像片分量的分配码率,T C′表示所述第一图像片分量中已经编码的分辨率层级所占的码率,W′表示所述第一图像片分量中已经编码的分辨率层级在所述第一图像片分量的分配码率中所占的权重。
  22. 一种码率控制的方法,其特征在于,包括:
    获取图像片中第一图像片分量的分配码率;
    对所述第一图像片分量进行离散小波变换,获得所述第一图像片分量的分辨率层级;
    确定所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重;
    根据所述第一图像片分量的分配码率、所述第一图像片分量中已经编码的分辨率层级所占的码率、所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重、所述第一图像片分量中已经编码的分辨率层级的码率在所述第一图像片分量的分配码率中所占的权重,计算所述第一图像片分量中每个分辨率层级的分配码率。
  23. 根据权利要求22所述的方法,其特征在于,所述对所述第一图像片分量进行离散小波变换,获得所述第一图像片分量的分辨率层级,包括:
    对所述第一图像片分量进行离散小波变换,获得所述第一图像片分量的(d+1)个分辨率层级,d为非负整数;
    所述确定所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重,包括:
    确定所述第一图像片分量的(d+1)个分辨率层级在所述第一图像片分量的分配码率中所占的比重为:ω=(W d+1,3W d×4 0,…,3W 3×4 d-3,3W 2×4 d-2,3W 1×4 d-1),其中,W 1<W 2<W 3<…<W d<3W d+1
  24. 根据权利要求23所述的方法,其特征在于,所述计算所述第一图像片分量中每个分辨率层级的分配码率,包括:
    根据如下公式计算所述第一图像片分量的第i+1个分辨率层级的分配码率r i+1
    Figure PCTCN2019073139-appb-100015
    T C′=∑R done
    W′=∑w done
    其中,T C表示所述第一图像片分量的分配码率,T C′表示所述第一图像片分量中已经编码的分辨率层级所占的码率,W′表示所述第一图像片分量中已经编码的分辨率层级在所述第一图像片分量的分配码率中所占的权重。
  25. 一种编码装置,其特征在于,包括:
    获取单元,用于获取图像帧中的第一图像片,所述图像帧被划分为多个图像片;
    计算单元,用于根据所述获取单元获取的所述第一图像片的复杂度以及所述图像帧的压缩后总码率,计算所述第一图像片的预设码率;
    修正单元,用于通过第一基准码率修正所述计算单元计算得到的所述第一图像片的预设码率,使其向所述第一基准码率靠近,获得所述第一图像片的分配码率,所述第一基准码率根据所述图像帧中至少部分图像片的预设码率的平均值确定。
  26. 根据权利要求25所述的编码装置,其特征在于,所述第一基准码率等于所述多个图像片的平均码率,其中,所述平均码率等于所述图像帧中全部图像片的预设码率的平均值。
  27. 根据权利要求25所述的编码装置,其特征在于,
    当所述第一图像片的预设码率与所述多个图像片的平均码率之差超过第一阈值时,所述第一基准码率等于所述平均码率,其中,所述平均码率等于所述图像帧中全部图像片的预设码率的平均值;
    当所述第一图像片的预设码率与所述平均码率之差的绝对值未超过所 述第一阈值时,所述第一基准码率等于所述第一图像片的预设码率。
  28. 根据权利要求25所述的编码装置,其特征在于,
    当所述第一图像片的预设码率大于所述多个图像片的平均码率时,所述第一基准码率等于所述多个图像片中预设码率大于所述平均码率的图像片的预设码率的平均值,其中,所述平均码率等于所述图像帧中全部图像片的预设码率的平均值;
    当所述第一图像片的预设码率小于所述平均码率时,所述第一基准码率等于所述多个图像片中预设码率小于所述平均码率的图像片的预设码率的平均值;
    当所述第一图像片的预设码率等于所述平均码率时,所述第一基准码率等于所述平均码率。
  29. 根据权利要求28所述的编码装置,其特征在于,所述修正单元用于:
    利用所述第一基准码率修正所述第一图像片的预设码率,使其向所述第一基准码率靠近,获得所述第一图像片的修正码率;
    利用第二基准码率继续修正所述第一图像片的修正码率,使其向所述第二基准码率靠近,获得所述第一图像片的分配码率,所述第二基准码率等于所述平均码率。
  30. 根据权利要求28所述的编码装置,其特征在于,所述修正单元用于:
    利用所述第一基准码率修正所述第一图像片的预设码率,使其向所述第一基准码率靠近,获得所述第一图像片的修正码率;
    利用第二基准码率继续修正所述第一图像片的修正码率,使其向所述第二基准码率靠近,获得所述第一图像片的分配码率,其中,
    当所述第一图像片的修正码率与所述平均码率之差的绝对值超过第二阈值时,所述第二基准码率等于所述平均码率,
    当所述第一图像片的修正码率与所述平均码率之差的绝对值未超过所述第二阈值时,所述第二基准码率等于所述第一图像片的修正码率。
  31. 根据权利要求25至28中任一项所述的编码装置,其特征在于,所述第一图像片的分配码率等于所述第一图像片的预设码率与第一修正因子的乘积,其中,所述第一修正因子根据所述第一图像片的预设码率与所述第 一基准码率的比值确定。
  32. 根据权利要求31所述的编码装置,其特征在于,所述修正单元用于,根据如下公式,计算所述第一图像片的分配码率R i
    Figure PCTCN2019073139-appb-100016
    Figure PCTCN2019073139-appb-100017
    其中,r i表示所述第一图像片的预设码率,
    Figure PCTCN2019073139-appb-100018
    表示所述第一基准码率,
    Figure PCTCN2019073139-appb-100019
    表示所述第一修正因子,x为常数。
  33. 根据权利要求29或30所述的编码装置,其特征在于,所述第一图像片的分配码率等于所述第一图像片的修正码率与第二修正因子的乘积,其中,所述第二修正因子根据所述第一图像片的修正码率与所述第二基准码率的比值确定;
    其中,所述第一图像片的修正码率等于所述第一图像片的预设码率与第一修正因子的乘积,其中,所述第一修正因子根据所述第一图像片的预设码率与所述第一基准码率的比值确定。
  34. 根据权利要求33所述的编码装置,其特征在于,所述修正单元用于,根据如下公式,计算所述第一图像片的分配码率R i
    Figure PCTCN2019073139-appb-100020
    Figure PCTCN2019073139-appb-100021
    Figure PCTCN2019073139-appb-100022
    Figure PCTCN2019073139-appb-100023
    其中,r i′表示所述第一图像片的修正码率,
    Figure PCTCN2019073139-appb-100024
    表示所述第二基准码率,
    Figure PCTCN2019073139-appb-100025
    表示所述第二修正因子,r i表示所述第一图像片的预设码率,
    Figure PCTCN2019073139-appb-100026
    表示所述第一基准码率,
    Figure PCTCN2019073139-appb-100027
    表示所述第一修正因子,x与y为常数。
  35. 根据权利要求25至34中任一项所述的编码装置,其特征在于,
    所述获取单元还用于,根据人眼对图像分量的敏感程度,获取所述第一图像片的各个图像片分量的码率分配权重,其中,至少一个图像片分量的码率分配权重之和大于其余图像片分量的码率分配权重之和;
    所述计算单元还用于,根据所述第一图像片的分配码率,以及所述获取 单元获取的所述第一图像片的每个图像片分量的码率分配权重,计算所述第一图像片的每个图像片分量的分配码率。
  36. 根据权利要求35所述的编码装置,其特征在于,所述第一图像片包括红绿绿蓝RGGB四个图像片分量,其中,两个绿色图像片分量的码率分配权重之和大于红色图像片分量与蓝色图像片分量的码率分配权重之和。
  37. 根据权利要求35或36所述的编码装置,其特征在于,所述编码装置还包括:
    小波变换单元,用于对所述第一图像片中的第一图像片分量进行离散小波变换,获得所述第一图像片分量的分辨率层级;
    确定单元,用于确定所述小波变换单元得到的所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重;
    所述计算单元还用于,根据所述第一图像片分量的分配码率、所述第一图像片分量中已经编码的分辨率层级所占的码率、所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重、所述第一图像片分量中已经编码的分辨率层级的码率在所述第一图像片分量的分配码率中所占的权重,计算所述第一图像片分量中每个分辨率层级的分配码率。
  38. 根据权利要求37所述的编码装置,其特征在于,所述小波变换单元用于,对所述第一图像片分量进行离散小波变换,获得所述第一图像片分量的(d+1)个分辨率层级,d为非负整数;
    所述确定单元用于,确定所述第一图像片分量的(d+1)个分辨率层级在所述第一图像片分量的分配码率中所占的比重为:ω=(W d+1,3W d×4 0,…,3W 3×4 d-3,3W 2×4 d-2,3W 1×4 d-1),其中,W 1<W 2<W 3<…<W d<3W d+1
  39. 根据权利要求38所述的编码装置,其特征在于,所述计算单元用于,根据如下公式计算所述第一图像片分量的第i+1个分辨率层级的分配码率r i+1
    Figure PCTCN2019073139-appb-100028
    T C′=∑R done
    W′=∑w done
    其中,T C表示所述第一图像片分量的分配码率,T C′表示所述第一图像片分量中已经编码的分辨率层级所占的码率,W′表示所述第一图像片分量中已经编码的分辨率层级在所述第一图像片分量的分配码率中所占的权重。
  40. 根据权利要求25至39中任一项所述的编码装置,其特征在于,所述图像帧为原始图像帧经过填充后得到的,当从所述原始图像帧的左上角开始编码时,所述填充的位置在所述原始图像帧的左上角。
  41. 一种编码装置,其特征在于,包括:
    获取单元,用于获取图像片的分配码率;
    所述获取单元还用于,根据人眼对图像分量的敏感程度,获取所述图像片的各个图像片分量的码率分配权重,其中,至少一个图像片分量的码率分配权重之和大于其余图像片分量的码率分配权重之和;
    计算单元,用于根据所述图像片的分配码率,以及所述获取单元得到的每个图像片分量的码率分配权重,计算所述每个图像片分量的分配。
  42. 根据权利要求41所述的编码装置,其特征在于,所述图像片包括红绿绿蓝RGGB四个图像片分量,两个绿色图像片分量的码率分配权重之和大于红色图像片分量与蓝色图像片分量的码率分配权重之和。
  43. 根据权利要求41或42所述的编码装置,其特征在于,所述编码装置还包括:
    小波变换单元,用于对所述图像片中的第一图像片分量进行离散小波变换,获得所述第一图像片分量的分辨率层级;
    确定单元,用于确定所述小波变换单元得到的所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重;
    所述计算单元还用于,根据所述第一图像片分量的分配码率、所述第一图像片分量中已经编码的分辨率层级所占的码率、所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重、所述第一图像片分量中已经编码的分辨率层级的码率在所述第一图像片分量的分配码率中所占的权重,计算所述第一图像片分量中每个分辨率层级的分配码率。
  44. 根据权利要求43所述的编码装置,其特征在于,所述小波变换单元用于,对所述第一图像片分量进行离散小波变换,获得所述第一图像片分量的(d+1)个分辨率层级,d为非负整数;
    所述确定单元用于,确定所述第一图像片分量的(d+1)个分辨率层级在所述第一图像片分量的分配码率中所占的比重为:ω=(W d+1,3W d×4 0,…,3W 3×4 d-3,3W 2×4 d-2,3W 1×4 d-1),其中,W 1<W 2<W 3<…<W d<3W d+1
  45. 根据权利要求44所述的编码装置,其特征在于,所述计算单元用于,根据如下公式计算所述第一图像片分量的第i+1个分辨率层级的分配码率r i+1
    Figure PCTCN2019073139-appb-100029
    T C′=∑R done
    W′=∑w done
    其中,T C表示所述第一图像片分量的分配码率,T C′表示所述第一图像片分量中已经编码的分辨率层级所占的码率,W′表示所述第一图像片分量中已经编码的分辨率层级在所述第一图像片分量的分配码率中所占的权重。
  46. 一种编码装置,其特征在于,包括:
    获取单元,用于获取图像片中第一图像片分量的分配码率;
    小波变换单元,用于对所述第一图像片分量进行离散小波变换,获得所述第一图像片分量的分辨率层级;
    确定单元,用于确定所述小波变换单元得到的所述第一图像片分量的各个分辨率层级的码率在所述获取单元得到的所述第一图像片分量的分配码率中所占的比重;
    计算单元,用于根据所述第一图像片分量的分配码率、所述第一图像片分量中已经编码的分辨率层级所占的码率、所述第一图像片分量的各个分辨率层级的码率在所述第一图像片分量的分配码率中所占的比重、所述第一图像片分量中已经编码的分辨率层级的码率在所述第一图像片分量的分配码 率中所占的权重,计算所述第一图像片分量中每个分辨率层级的分配码率。
  47. 根据权利要求46所述的编码装置,其特征在于,所述小波变换单元用于,对所述第一图像片分量进行离散小波变换,获得所述第一图像片分量的(d+1)个分辨率层级,d为非负整数;
    所述确定单元用于,确定所述第一图像片分量的(d+1)个分辨率层级在所述第一图像片分量的分配码率中所占的比重为:ω=(W d+1,3W d×4 0,…,3W 3×4 d-3,3W 2×4 d-2,3W 1×4 d-1),其中,W 1<W 2<W 3<…<W d<3W d+1
  48. 根据权利要求47所述的编码装置,其特征在于,所述计算单元,用于根据如下公式计算所述第一图像片分量的第i+1个分辨率层级的分配码率r i+1
    Figure PCTCN2019073139-appb-100030
    T C′=∑R done
    W′=∑w done
    其中,T C表示所述第一图像片分量的分配码率,T C′表示所述第一图像片分量中已经编码的分辨率层级所占的码率,W′表示所述第一图像片分量中已经编码的分辨率层级在所述第一图像片分量的分配码率中所占的权重。
  49. 一种图像处理装置,其特征在于,包括:存储器与处理器,所述存储器用于存储指令,所述处理器用于执行所述存储器存储的指令,并且对所述存储器中存储的指令的执行使得,所述处理器用于执行如权利要求1至24中任一项所述的方法。
  50. 一种计算机存储介质,其特征在于,其上存储有计算机程序,所述计算机程序被计算机执行时使得,所述计算机执行如权利要求1至24中任一项所述的方法。
  51. 一种包含指令的计算机程序产品,其特征在于,所述指令被计算机执行时使得计算机执行如权利要求1至24中任一项所述的方法。
PCT/CN2019/073139 2019-01-25 2019-01-25 码率分配的方法与装置 WO2020150992A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980005237.XA CN111279697A (zh) 2019-01-25 2019-01-25 码率分配的方法与装置
PCT/CN2019/073139 WO2020150992A1 (zh) 2019-01-25 2019-01-25 码率分配的方法与装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/073139 WO2020150992A1 (zh) 2019-01-25 2019-01-25 码率分配的方法与装置

Publications (1)

Publication Number Publication Date
WO2020150992A1 true WO2020150992A1 (zh) 2020-07-30

Family

ID=70999806

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/073139 WO2020150992A1 (zh) 2019-01-25 2019-01-25 码率分配的方法与装置

Country Status (2)

Country Link
CN (1) CN111279697A (zh)
WO (1) WO2020150992A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1448892A (zh) * 2003-04-07 2003-10-15 西安交通大学 一种jpeg2000多图像片压缩率预分配算法
CN101212543A (zh) * 2006-12-30 2008-07-02 中国科学院计算技术研究所 基于图像质量和码率约束的jpeg2000码率控制方法
JP2009033604A (ja) * 2007-07-30 2009-02-12 Victor Co Of Japan Ltd 映像信号符号化装置および方法
CN102036073A (zh) * 2010-12-21 2011-04-27 西安交通大学 基于视觉潜在注意力目标区域的jpeg2000图像编解码方法

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000261799A (ja) * 1999-03-10 2000-09-22 Fujitsu Ltd 可変レート動画像符号化装置
JP4364350B2 (ja) * 1999-07-06 2009-11-18 富士通株式会社 可変レート動画像符号化装置
CN100562118C (zh) * 2007-07-03 2009-11-18 上海富瀚微电子有限公司 一种视频编码的码率控制方法
CN101127909B (zh) * 2007-09-29 2010-07-07 华为技术有限公司 一种图像码率控制方法及装置
CN106331704B (zh) * 2015-07-07 2019-10-22 杭州海康威视数字技术股份有限公司 一种视频码率控制方法及视频编码装置
CN109076212A (zh) * 2017-12-27 2018-12-21 深圳市大疆创新科技有限公司 码率控制的方法与编码装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1448892A (zh) * 2003-04-07 2003-10-15 西安交通大学 一种jpeg2000多图像片压缩率预分配算法
CN101212543A (zh) * 2006-12-30 2008-07-02 中国科学院计算技术研究所 基于图像质量和码率约束的jpeg2000码率控制方法
JP2009033604A (ja) * 2007-07-30 2009-02-12 Victor Co Of Japan Ltd 映像信号符号化装置および方法
CN102036073A (zh) * 2010-12-21 2011-04-27 西安交通大学 基于视觉潜在注意力目标区域的jpeg2000图像编解码方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
XUE, JIANRU ET AL.: "Proto-Object Based Rate Control for JPEG2000: An Approach to Content-Based Scalability", IEEE TRANSACTIONS ON IMAGE PROCESSING, vol. 20, no. 4, 20 September 2010 (2010-09-20), XP011411763, DOI: 20190909162304 *

Also Published As

Publication number Publication date
CN111279697A (zh) 2020-06-12

Similar Documents

Publication Publication Date Title
CN103227775B (zh) 用于处理图像或视频数据的方法和系统
CN107771392B (zh) 用于高动态范围图像的实时内容自适应感知量化器
US20180376143A1 (en) Encoding of pictures in a video
CN108885783A (zh) 编码和解码可逆制作质量单层视频信号
JP6141295B2 (ja) 知覚的に無損失のおよび知覚的に強調された画像圧縮システムならびに方法
JP6986868B2 (ja) 画像符号化装置、画像復号装置、画像符号化方法、画像復号方法、プログラム
JP2002335527A (ja) 動画フレーム符号化方法、適応的量子化方法、データ圧縮レート決定方法、及びエンコーダ
JP2001512651A (ja) 量子化マトリクスのフレーム毎の計算方法
CA2294225A1 (en) Apparatus and method for macroblock based rate control in a coding system
JP2010524298A (ja) 圧縮データ量の制御
US20080298702A1 (en) Fixed rate JPEG encoding
Sun et al. An efficient DCT-based image compression system based on Laplacian transparent composite model
CN107211145A (zh) 几乎视觉无损的视频再压缩
JP6857973B2 (ja) 画像符号化装置及びその制御方法
EP3545677A1 (en) Methods and apparatuses for encoding and decoding video based on perceptual metric classification
US9955160B1 (en) Video encoding using adaptive pre-filtering
JP2017216630A (ja) 画像符号化装置及びその制御方法
KR100823145B1 (ko) 관심영역 기반의 영상 화질개선장치 및 양자화기기 및 그동작 방법
JP2002262288A (ja) 画像データ送信装置および画像データ受信装置
WO2020150992A1 (zh) 码率分配的方法与装置
US10356408B2 (en) Image encoding apparatus and method of controlling the same
US8059712B2 (en) Independently adjusting the quality levels for luminance and chrominance channels in a digital image
JP2017216625A (ja) 画像符号化装置及びその制御方法
Battiato et al. JPEG2000 coded images optimization using a content-dependent approach
US8478060B2 (en) Method and device for compressing an image and storage medium carrying an image compressed by said method

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

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

Country of ref document: EP

Kind code of ref document: A1