CN108235021B - Band mode determination method and device - Google Patents

Band mode determination method and device Download PDF

Info

Publication number
CN108235021B
CN108235021B CN201810024207.0A CN201810024207A CN108235021B CN 108235021 B CN108235021 B CN 108235021B CN 201810024207 A CN201810024207 A CN 201810024207A CN 108235021 B CN108235021 B CN 108235021B
Authority
CN
China
Prior art keywords
processed
value
coding block
pixel values
target
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201810024207.0A
Other languages
Chinese (zh)
Other versions
CN108235021A (en
Inventor
朱洪波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
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 Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201810024207.0A priority Critical patent/CN108235021B/en
Publication of CN108235021A publication Critical patent/CN108235021A/en
Application granted granted Critical
Publication of CN108235021B publication Critical patent/CN108235021B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/117Filters, e.g. for pre-processing or post-processing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/132Sampling, masking or truncation of coding units, e.g. adaptive resampling, frame skipping, frame interpolation or high-frequency transform coefficient masking
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/70Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/80Details of filtering operations specially adapted for video compression, e.g. for pixel interpolation
    • H04N19/82Details of filtering operations specially adapted for video compression, e.g. for pixel interpolation involving filtering within a prediction loop

Landscapes

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

Abstract

The embodiment of the invention provides a band mode determining method and a band mode determining device, wherein the method comprises the following steps: scanning the obtained coding block to be processed to obtain a pixel value of the coding block to be processed; determining the maximum pixel value and the minimum pixel value of the coding block to be processed by using the size of the pixel value of the coding block to be processed; and aiming at each target index number, calculating the target offset of the coding block to be processed in the band corresponding to the first target index number according to the pixel values of the coding block to be processed and the target source block respectively positioned in the band corresponding to the first target index number, determining an optimal initial value by using the calculated target offset, and determining a second preset number of offsets by using the optimal initial value. The scheme provided by the embodiment of the invention reduces the complexity of the band mode.

Description

Band mode determination method and device
Technical Field
The present invention relates to the field of video coding technologies, and in particular, to a band mode determination method and apparatus.
Background
SAO (sample adaptive offset) is a new coding tool introduced by high efficiency Video coding hevc (high efficiency Video coding). For a coding block, SAO divides pixel values into several classes, each class corresponding to an offset, that is, for all pixel values in a certain class, the same offset is added, and the offset ranges from-7 to 7.
There are two modes of SAO, one mode being a boundary edge mode, four in total, vertical, horizontal, 45 degrees and 135 degrees. As shown in fig. 1, in the boundary edge mode, the central pixel value is c, and the adjacent pixel values are a and b, in the grid nine, a, c and b are in a straight line, and are centered at c, and a and b form a boundary mode of different straight lines around c, as shown in fig. 1(a) to 1 (d).
Another mode of SAO is the band mode, in which pixel values taking the range 0-255 are evenly divided into 32 bands, each band having a range size equal to 8. The encoder needs to select the starting point of one band, namely the initial value of the band, then, four bands are continuously started from the starting point, the encoder determines an offset for each band, and the same offset is added when the pixel value falls into one band. If four strips starting at band 8 are selected, with pixel values ranging from [64,71], [72,79], [80,87], [88,95], the encoder determines an offset for each of the four strips, off0, off1, off2, off3, and then each pixel value ranging from [64,71] plus off0, and so on.
However, in the process of implementing the invention, the prior art has at least the following problems:
in one HEVC 4k real-time encoder, in order to fully utilize multiple cores, a two-pass encoding structure is adopted, the first pass is full parallel encoding, and the second pass is information using the first pass, wherein the second pass is encoding of a control step, and the second pass has strong dependency and cannot efficiently utilize multiple cores, so that the steps need to be controlled during encoding.
In the process of the control step during encoding, since the SAO parameter estimation accounts for 25% of the total complexity of the second pass, and in the SAO parameter estimation, there are 4 edge modes, each of the 4 cases, there are 16 edge modes, and there are 32 band modes in total, the complexity of the edge modes is one half of that of the band modes, so that the complexity of the band modes is reduced, and the problem to be solved is to increase the encoding speed.
For the above problem to be solved, in the prior art, for 32 bands of the band mode, the optimal offset of each band needs to be estimated one by one, after the optimal offset of each band is estimated, an initial value of each band is selected from 0 to 28, the initial value corresponding to each band is estimated by a method of calculating rate distortion cost, and then the band parameter is determined. Therefore, in the prior art, the optimal offsets of 32 bands need to be estimated one by one, the coding block to be processed can be given the greatest advantage by calculating a rate-distortion cost method, that is, evaluating and selecting four offsets with which initial values are the starting points, and the band mode can be determined by estimating the optional initial values of each band one by one, so that the method for determining the band parameters is high in complexity.
Disclosure of Invention
Embodiments of the present invention provide a method and an apparatus for determining a band mode, so as to reduce complexity of the band mode and further improve an encoding speed. The specific technical scheme is as follows:
scanning the obtained coding block to be processed to obtain a pixel value of the coding block to be processed;
determining the maximum pixel value and the minimum pixel value of the coding block to be processed by utilizing the size of the pixel value of the coding block to be processed;
for each target index number, calculating the target offset of the coding block to be processed in the band corresponding to the first target index number according to the pixel values of the coding block to be processed and the target source block respectively positioned in the band corresponding to the first target index number, wherein the first threshold is the minimum pixel value divided by a preset value, the second threshold is the maximum pixel value divided by a preset value, the target index number is a number corresponding to a first preset number of bands, the target index number is greater than a first threshold value and less than a second threshold value, for identifying within which band the encoded block pixels to be processed or the target source block pixels are distributed, the target source block is a source block corresponding to the coding block to be processed, the first target index number is any one of a first preset number of target index numbers, the target offset is the optimal offset output in the band corresponding to the first target index number;
an optimal starting value is determined using the calculated target offset values, and a second predetermined number of offset values are determined using the optimal starting value.
Further, after or before the determining the maximum pixel value and the minimum pixel value of the coding block to be processed by using the size of the pixel value of the coding block to be processed, the method further comprises:
calculating the average value of absolute differences between the pixel values of the odd rows and the pixel values of the adjacent even rows in the obtained pixel values by using the pixel values of the coding blocks to be processed, wherein the row number value corresponding to the odd row is smaller than the row number value corresponding to the adjacent even row;
judging whether the calculated average value is smaller than a third threshold value;
if the average value is smaller than the third threshold value, both the target source block and the coding block to be processed are down-sampled to a preset proportion of the area of the target source block, and the down-sampled coding block to be processed and the target source block are obtained;
and taking the code block to be processed after the down sampling as a new code block to be processed, and returning to the step of scanning the obtained code block to be processed to obtain the pixel value of the code block to be processed.
Further, the calculating an average value of absolute differences between pixel values of an odd line and pixel values of an adjacent even line among the acquired pixel values includes:
calculating an average value abshv of absolute differences between pixel values of odd lines and pixel values of adjacent even lines in the obtained pixel values according to the obtained pixel values blk (i, j) of the coding block to be processed and the following expression;
the expression is as follows:
Figure BDA0001544451950000031
w is the width of the coding block to be processed, h is the height of the coding block to be processed, w and h are even numbers, i is a row where a pixel value in the coding block to be processed is located, j is a column where the pixel value in the coding block to be processed is located, i and j are natural numbers, and abs (·) is an absolute value function.
Further, the determining a maximum pixel value and a minimum pixel value of the coding block to be processed by using the size of the pixel value of the coding block to be processed includes:
and traversing the pixel values of the coding blocks to be processed, and comparing the pixel values of the coding blocks to be processed to obtain the maximum pixel value and the minimum pixel value of the coding blocks to be processed.
Further, the determining a maximum pixel value and a minimum pixel value of the coding block to be processed by using the size of the pixel value of the coding block to be processed includes:
sorting the pixel values of the coding blocks to be processed according to the sizes to obtain a sequence after the pixel values of the coding blocks to be processed are sorted;
-selecting the maximum pixel value and the minimum pixel value from the sequence.
Further, the sorting the pixel values of the coding blocks to be processed according to size to obtain a sequence of the sorted pixel values of the coding blocks to be processed, includes:
and sequencing the pixel values of the coding blocks to be processed from large to small to obtain a sequence after the pixel values of the coding blocks to be processed are sequenced.
Further, the determining an optimal starting value and determining a second preset number of offsets using the optimal starting value includes:
and determining an optimal starting value by using the calculated target offset and calculating the rate distortion cost, and determining a second preset number of offsets by using the optimal starting value.
Further, the third threshold is 42/16.
A band mode determination apparatus, the apparatus comprising:
the device comprises a pixel value obtaining module, a coding block processing module and a processing module, wherein the pixel value obtaining module is used for scanning an obtained coding block to be processed to obtain a pixel value of the coding block to be processed;
the pixel value determining module is used for determining the maximum pixel value and the minimum pixel value of the coding block to be processed by utilizing the size of the pixel value of the coding block to be processed;
a target offset calculation module, configured to calculate, for each target index number, a target offset of the to-be-processed coding block in a band corresponding to a first target index number according to pixel values of the to-be-processed coding block and the target source block that are respectively located in the band corresponding to the first target index number, wherein the first threshold is the minimum pixel value divided by a preset value, the second threshold is the maximum pixel value divided by a preset value, the target index number is a number corresponding to a first preset number of bands, the target index number is greater than a first threshold value and less than a second threshold value, for identifying within which band the encoded block pixels or target source block pixels to be processed are distributed, the first target index number is any one of a first preset number of target index numbers, the target source block is a source block corresponding to the coding block to be processed, and the target offset is an optimal offset output in a band corresponding to a first target index number;
and the first offset determining module is used for determining an optimal starting value by utilizing the calculated target offset and determining a second preset number of offsets by utilizing the optimal starting value.
Further, the apparatus further comprises:
the average value calculating module is used for calculating the average value of absolute differences between the pixel values of the odd lines and the pixel values of the adjacent even lines in the obtained pixel values by using the pixel values of the coding blocks to be processed, and the line number value corresponding to the odd line is smaller than the line number value corresponding to the adjacent even line;
the judging module is used for judging whether the calculated average value is smaller than a third threshold value; if the sampling rate is less than the preset threshold, triggering a down-sampling module;
the down-sampling module is used for down-sampling the target source block and the coding block to be processed to a preset proportion of the area of the target source block to obtain the down-sampled coding block to be processed and the target source block;
and the downsampling obtaining module is used for taking the downsampled coding block to be processed as a new coding block to be processed and triggering the pixel value obtaining module.
Further, the average value calculation module includes:
the calculation submodule is used for calculating an average value abshv of absolute differences between pixel values of odd lines and pixel values of adjacent even lines in the obtained pixel values according to the following expression according to the obtained pixel values blk (i, j) of the coding block to be processed;
the expression is as follows:
Figure BDA0001544451950000051
w is the width of the coding block to be processed, h is the height of the coding block to be processed, w and h are even numbers, i is a row where a pixel value in the coding block to be processed is located, j is a column where the pixel value in the coding block to be processed is located, i and j are natural numbers, and abs (·) is an absolute value function.
Further, the pixel value determination module includes:
and the traversing module is used for traversing the pixel values of the coding blocks to be processed and obtaining the maximum pixel value and the minimum pixel value of the coding blocks to be processed by comparing the pixel values of the coding blocks to be processed.
Further, the pixel value determination module includes:
the first sequencing submodule is used for sequencing the pixel values of the coding blocks to be processed according to the sizes to obtain a sequence after the pixel values of the coding blocks to be processed are sequenced;
a selection submodule for selecting the maximum pixel value and the minimum pixel value from the sequence.
Further, the first ordering sub-module includes:
and the second sequencing unit is used for sequencing the pixel values of the coding blocks to be processed from large to small to obtain a sequence after the pixel values of the coding blocks to be processed are sequenced.
Further, the offset determination module includes:
and the second offset determining submodule is used for determining an optimal starting value by a method of calculating rate distortion cost by using the calculated target offset, and determining a second preset number of offsets by using the optimal starting value.
Further, the third threshold is 42/16.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute any of the above-described band mode determination methods.
In yet another aspect of the present invention, the present invention also provides a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the above-mentioned band mode determination methods.
The band mode determining method and device provided by the embodiment of the invention can scan the obtained coding block to be processed to obtain the pixel value of the coding block to be processed; determining the maximum pixel value and the minimum pixel value of the coding block to be processed by utilizing the size of the pixel value of the coding block to be processed; for each target index number, the target index number is greater than a first threshold value and smaller than a second threshold value, and according to pixel values of the coding block to be processed and the target source block respectively located in a band corresponding to the first target index number, calculating a target offset of the coding block to be processed in the band corresponding to the first target index number; an optimal starting value is determined using the calculated target offset values, and a second predetermined number of offset values are determined using the optimal starting value. According to the method, the optimal offset of the 32 bands is not required to be estimated one by one, and only the band corresponding to each target index number in the range smaller than the first threshold and larger than the second threshold is required to be estimated, so that the complexity of the band mode is reduced, and the encoding speed is further improved. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a schematic diagram of a prior art boundary pattern;
FIG. 2 is a first flow chart of band mode determination according to an embodiment of the present invention;
FIG. 3 is a second flowchart of band mode determination according to an embodiment of the present invention;
FIG. 4 is a third flowchart of band mode determination according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a band mode apparatus according to an embodiment of the present invention;
fig. 6 is a schematic diagram of an electronic device according to an embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In one implementation manner of the embodiment of the invention, a band mode determination method is provided. Referring to fig. 2, fig. 2 is a method for determining a band mode according to an embodiment of the present invention, which includes the following steps:
s101, scanning the obtained coding block to be processed to obtain a pixel value of the coding block to be processed;
wherein the scanning object, i.e. the coding block to be processed, can be expressed in points per inch by the scanning element. The unit is dot per inch dpi, and the larger the dpi value, the better the scanning effect.
The pixel value is expressed by multiplying the vertical resolution and the horizontal resolution.
S102, determining the maximum pixel value and the minimum pixel value of the coding block to be processed by using the size of the pixel value of the coding block to be processed;
it should be noted that, after the pixel values of the coding blocks to be processed are obtained, the maximum pixel value and the minimum pixel value are respectively found from all the pixel values.
Before or after S102, the method further includes:
calculating the average value of absolute differences between the pixel values of the odd lines and the pixel values of the adjacent even lines in the obtained pixel values by using the pixel values of the coding blocks to be processed, wherein the line number value corresponding to the odd line is smaller than the line number value corresponding to the adjacent even line;
judging whether the calculated average value is smaller than a third threshold value;
if the average value is smaller than a third threshold value, both the target source block and the coding block to be processed are down-sampled to a preset proportion of the area of the target source block, and the down-sampled coding block to be processed and the target source block are obtained;
and taking the code block to be processed after the down sampling as a new code block to be processed, and returning to the step of executing the S101.
Therefore, in the embodiment, the target source block and the coding block to be processed are down-sampled to the preset proportion of the area of the target source block, and the final band mode parameter is determined by using the down-sampled coding block to be processed and the target source block.
In addition, the third threshold may be 42/16, and the preset ratio may be 1/2.
Wherein calculating an average value of absolute differences between pixel values of an odd-numbered line and pixel values of an adjacent even-numbered line among the acquired pixel values includes:
calculating an average value abshv of absolute differences between pixel values of odd lines and pixel values of adjacent even lines in the obtained pixel values according to the obtained pixel values blk (i, j) of the coding block to be processed and the following expression;
the expression is as follows:
Figure BDA0001544451950000081
w is the width of the coding block to be processed, h is the height of the coding block to be processed, w and h are both even numbers, i is a row where a pixel value in the coding block to be processed is located, j is a column where the pixel value in the coding block to be processed is located, i and j are both natural numbers, and abs (·) is an absolute value function.
Therefore, the average value to be obtained can be quickly and accurately obtained according to the expression.
One embodiment of S102 is:
and traversing the pixel values of the coding blocks to be processed, and comparing the pixel values of the coding blocks to be processed to obtain the maximum pixel value and the minimum pixel value of the coding blocks to be processed.
Therefore, the embodiment simply and quickly obtains the maximum pixel value and the minimum pixel value of the coding block to be processed by traversing the pixel values of the coding block to be processed.
Another embodiment of S102 is:
sorting the pixel values of the coding blocks to be processed according to the sizes to obtain a sequence after the pixel values of the coding blocks to be processed are sorted;
it should be noted that the ordering of the pixel values of the coding blocks to be processed may be from large to small, or from small to large, and the present invention is not limited to this.
For the sake of clarity in the description of the sequence obtained, an example is now given:
setting the pixel value of the coding block to be processed as follows: 16777210, 16777216, … …, 6777216;
sorting the pixel values from large to small, the following sequence is obtained:
16777216、16777210、……、6777216;
s304, selecting a maximum pixel value and a minimum pixel value from the sequence;
based on the above example, the maximum pixel value and the minimum pixel value are selected from the sorted sequence, that is, the first and last two pixel values of the sequence are directly obtained from 16777216, 16777210, … …, 6777216, the maximum pixel value of the sequence is 16777216, and the minimum pixel value is 6777216.
The maximum pixel value and the minimum pixel value are selected from the sequence.
Therefore, the maximum pixel value and the minimum pixel value are selected from the pixel values of the coding blocks to be processed after being sorted according to the size, so that the maximum pixel value and the minimum pixel value are obtained quickly and orderly, and wrong selection and selection omission are not prone to occurring.
One embodiment of sorting the pixel values of the coding blocks to be processed according to size to obtain a sequence after the pixel values of the coding blocks to be processed are as follows:
and sequencing the pixel values of the coding blocks to be processed from large to small to obtain a sequence after the pixel values of the coding blocks to be processed are sequenced.
Therefore, in the embodiment, the pixel value sequence with the pixel values from large to small is obtained according to the pixel values of the coding blocks to be processed from large to small, so that wrong selection and selection omission are not easy, and the maximum pixel value and the minimum pixel value are conveniently and accurately obtained.
S103, aiming at each target index number, calculating target offset of the coding blocks to be processed in the band corresponding to the first target index number according to pixel values of the coding blocks to be processed and the target source blocks respectively positioned in the band corresponding to the first target index number, wherein a first threshold is a minimum pixel value divided by a preset value, a second threshold is a maximum pixel value divided by the preset value, the target index numbers are numbers corresponding to the first preset number of bands, the target index numbers are larger than the first threshold and smaller than the second threshold and are used for identifying which band the coding block pixels to be processed or the target source block pixels are distributed in, the target source blocks are source blocks corresponding to the coding blocks to be processed, the first target index numbers are any one of the first preset number of target index numbers, and the target offset is an offset output in the band corresponding to the first target index number;
the source block is a coded block before the input video or image is not coded, and the source block may be a source video block or a source image block. The coding blocks to be processed are coded source blocks, also called reconstructed blocks, the initial value range of the band is any one of values from 0 to 28, the value range of the band is from 0 to 31, the target index number is 32, that is, the first preset number may be 32.
It should be noted that the value of the pixel value is 0 to 255, 0 to 255 are equally divided into 32 parts, the width of each band is 8, the initial value of the 1 st band is 0 to 7, the 2 nd band is 8 to 15, and so on, the range of the n-th band is 8 × (n-1) to 8 × (n-1) +7, so the minimum pixel value vmin belongs to the band corresponding to the minimum pixel value divided by 8, the maximum pixel value vmax belongs to the band corresponding to vmax divided by 8, and is represented by binary: vmin > >3, > > is a binary right-shift symbol, vmin > >3 is vmin divided by 8, vmax > >3 is vmax divided by 8, and the value range of the offset to be estimated is vmin > > 3-vmax > > 3. Wherein, the preset value can be 8.
In addition, since there are 32 bands in total, the initial value is at most 32, i is 8, i ranges from 0 to 31, i is the band range, i is the number of bands, and the band filtering is performed on the 4 consecutive bands from the initial value, so the last band can be only 28 x 8 at most, and when the initial value of the band is obtained, the multiplied 8 is omitted, so the initial value of the band can be any integer from 0 to 28.
The following briefly describes the estimation process of the target offset, which is the optimal offset of the band in the band mode parameters, and it can be known from the above description of the band that there are 32 bands and 8 pixels per band, and in the prior art, the target offset of each band needs to be determined and calculated 32 times in total. And calling a function for each band, inputting a target source block, a reconstruction block and a target index number of the band, wherein the target index number is used for determining which part of pixel distribution is, if the target index is 0, calculating the band corresponding to the pixel value of the reconstruction block in the range of 0-7, if the target index is 5, calculating the band corresponding to the pixel value of the reconstruction block in the range of 40-47, and outputting the optimal offset of the current band.
The first step of the method of this step is to reduce the calculation load of offset for each band. Originally, target index numbers are required to be calculated to be 0-31, only target offset of each target index number corresponding to band in a range smaller than a first threshold value and larger than a second threshold value is calculated in the step, and the rest offsets are set to be 0, so that the calculation complexity is obviously simplified.
The Offset determination process is as follows:
setting a target index idx of one band, determining the pixel value range of idx corresponding to the band to be idx 8 to idx 8+7, and for the pixel values of the reconstruction blocks distributed in the range and the pixel values of the target source blocks corresponding to the pixel values, turning toMethod for overcomputing rate-distortion cost, let its set be G { (pxl)org,pxlrcn)|idx×8+7≥pxlrcnNot less than idx multiplied by 8}, wherein pxlrcnIs the pixel value in the reconstructed block, pxlorgThe pixel in the target source block corresponding to the reconstructed block, the offset value range is-7 to 7, the optimal offset can make the encoding of the offset obtain higher encoding efficiency, and the determination method is to minimize the rate distortion cost, that is, the following expression is minimum:
Figure BDA0001544451950000111
where, rate (offset) is the code rate required to encode the offset, and λ is the lagrangian constant, which is related to the quantization parameter.
The above formula is divided into two parts, the first part (pxl)org-pxlrcn-offset)2Is the sum of the squared differences of the target source block and the reconstructed block within the band after this offset is added, and the second part λ × rate (offset) is the weighted code rate.
S104, determining an optimal starting value by using the calculated target offset, and determining a second preset number of offsets by using the optimal starting value.
Wherein the second preset number may be 4.
Based on the above description of the band mode parameter estimation process, it can be known that the initial value of the band mode is any value in the range of 0-28, and the determination process is to find an optimal initial value after outputting the optimal offset of the current band, so that four offsets from the initial value can obtain the maximum coding efficiency, and then encode the initial value and the four offsets into the code stream. The lower code rate is obtained under the same quality, and the higher quality is obtained under the same code rate.
After the optimal offset of each band is determined, the minimum cost rdcost of each band is obtained, and let rdcost of the target index number idx of the band be denoted as rdcost (idx), and the band mode start value idxstt is determined by minimizing the following expression: the sum of rdcosts of four consecutive bands starting from this starting value is minimized, i.e. the sum of the following equations:
rdcost(idxstt)+rdcost(idxstt+1)+rdcost(idxstt+2)+rdcost(idxstt+3)。
the method provided by the embodiment of the invention saves the cost of obtaining the optimal offset, firstly reduces the range of the offset needing to be actually calculated through the minimum pixel value and the maximum pixel value, and then reduces the number of pixels for calculating rdcost (offset) through down-sampling, thereby saving calculation.
In particular, the method comprises the following steps of,
and determining an optimal starting value by using the calculated target offset and a method for calculating rate distortion cost, and determining a second preset number of offsets by using the optimal starting value.
Therefore, the embodiment evaluates which initial value is selected as the four offsets of the starting point by a method for calculating the rate distortion cost, so that the maximum advantage can be brought to the coding block to be processed, and the determination effect of the band mode parameter is improved.
Therefore, the band mode determining method provided by the embodiment of the invention does not need to calculate the target offset of each band, only calculates the target offset of each band corresponding to each target index number in a range smaller than the first threshold and larger than the second threshold, sets the rest offsets to be 0, and determines a second preset number of offsets by determining an optimal starting value and using the optimal starting value, so that the complexity of the band mode is reduced, and the encoding speed is further improved.
Therefore, the average value to be obtained can be quickly calculated according to the expression.
In one implementation of an embodiment of the present invention, another band mode determination method is provided. Referring to fig. 3, fig. 3 is a flowchart of band mode parameter determination according to another embodiment of the present invention, which includes the following steps:
s201, scanning the obtained coding block to be processed to obtain a pixel value of the coding block to be processed;
s201 to S202 are the same as the methods executed by S101 to S102 in the embodiment of fig. 2, respectively. Therefore, all the embodiments in fig. 2 are applicable to fig. 3, and can achieve the same or similar beneficial effects, and are not described herein again.
S202, determining the maximum pixel value and the minimum pixel value of the coding block to be processed by using the size of the pixel value of the coding block to be processed;
s203, calculating the average value of absolute differences between the pixel values of the odd lines and the pixel values of the adjacent even lines in the obtained pixel values by using the pixel values of the coding blocks to be processed, wherein the line number value corresponding to the odd line is smaller than the line number value corresponding to the adjacent even line;
in the encoder, SAO is processed in units of maximum coding units, the size of the maximum coding unit is 64 × 64 at the maximum, the size of the minimum coding unit is 8 × 8, and 64 × 64 is generally used.
The absolute difference between the pixel values of the odd-numbered line and the pixel values of the adjacent even-numbered line in the coding block to be processed in this step can be understood as the absolute value obtained by subtracting the pixel value of the 2 st line from the pixel value of the 1 st line, the absolute value obtained by subtracting the pixel value of the 4 th line from the pixel value of the 3 rd line, … …, and the absolute value obtained by subtracting the pixel value of the 64 th line from the pixel value of the 63 rd line.
S204, judging whether the calculated average value is smaller than a third threshold value; if the average value is smaller than the third threshold, executing S205; if the average value is greater than or equal to the third threshold, executing S207;
it should be noted that the down-sampling algorithm, i.e. down-sampling, is enabled only when the calculated average value, i.e. the gradient, is smaller than the third threshold value; the third threshold may be 42/16.
S205, down-sampling the target source block and the coding block to be processed to a preset proportion of the area of the target source block to obtain the down-sampled coding block to be processed and the target source block;
wherein the preset ratio may be 1/2.
It should be noted that, if the predetermined ratio is 1/2, the down-sampling in this step is to reduce the pixel value of the reconstructed block, i.e. the coding block to be processed, to half of the target source block, thereby saving half of the calculation amount compared to the prior art.
It should be noted that, in this step, both the target source block and the reconstructed block are downsampled, and downsampling is performed for the coding block to be processed whose average value is smaller than the third threshold.
S206, taking the code block to be processed after the down sampling as a new code block to be processed, and returning to the step of executing the S201;
the return execution S201 is the execution of S201 to S206.
S207, aiming at each target index number, calculating a target offset of the coding block to be processed in the band corresponding to the first target index number according to the pixel values of the coding block to be processed and the target source block respectively positioned in the band corresponding to the first target index number, wherein a first threshold is obtained by dividing the minimum pixel value by a preset value, a second threshold is obtained by dividing the maximum pixel value by a preset value, the target index number is a number corresponding to a first preset number of bands, the target index number is larger than the first threshold and smaller than the second threshold and is used for identifying in which band the pixels of the coding block to be processed or the pixels of the target source block are distributed, the target source block is a source block corresponding to the coding block to be processed, the first target index number is any one of the first preset number of target index numbers, and the target offset is an optimal offset output in the band corresponding to the first target index number;
s207 to S208 are the same as the methods performed by S103 to S104 in the embodiment of fig. 2. Therefore, all the embodiments in fig. 2 are applicable to fig. 3, and can achieve the same or similar beneficial effects, and are not described herein again.
S208, an optimal starting value is determined by using the calculated target offset, and a second preset number of offsets are determined by using the optimal starting value.
Therefore, in the band mode determining method provided by the embodiment of the present invention, by calculating the average value of the pixels of the coding blocks, for the coding blocks to be processed whose average value is smaller than the third threshold, both the target source block and the coding block to be processed are down-sampled to the preset proportion of the area of the target source block, the down-sampling directly saves the calculation of the preset proportion of the burden of calculating the target offset of each band, and the target offset corresponding to the band in the range smaller than the first threshold and larger than the second threshold is calculated by using the coding blocks to be processed and the target source block after down-sampling, the remaining offset is set to 0, and the complexity of the band mode is reduced by determining an optimal starting value and determining the second preset number of offsets by using the optimal starting value, thereby increasing the coding speed.
In one implementation of an embodiment of the present invention, another band mode determination method is provided. Referring to fig. 4, fig. 4 is a flowchart of band mode parameter determination according to another embodiment of the present invention, which includes the following steps:
s301, scanning the obtained coding block to be processed to obtain a pixel value of the coding block to be processed;
wherein, S301 is the same as the method executed by S101 in the embodiment of fig. 2. Therefore, all the embodiments in fig. 2 are applicable to fig. 4, and can achieve the same or similar beneficial effects, and are not described herein again.
S302, traversing the pixel values of the coding blocks to be processed, and comparing the pixel values of the coding blocks to be processed to obtain the maximum pixel value and the minimum pixel value of the coding blocks to be processed;
traversing the pixel values of the coding blocks to be processed can be understood as checking the pixel values of the coding blocks to be processed one by one; it can also be understood as creating two variables, which are denoted as a first variable and a second variable, and the two variables are respectively used for temporarily storing the maximum value and the minimum value of the pixel value, taking the pixel value of the first variable traversing the coding block to be processed as an example, such as: and assigning the first variable to an initial value, wherein the initial value can be 0, when the coding block to be processed is not traversed by the first variable, comparing the first variable with a current pixel which is not compared with the first variable, if the first variable is greater than the current pixel value, assigning the current pixel value to the first variable, taking the first variable after being assigned with the current pixel value as a new variable, returning to the step of comparing the first variable with the current pixel which is not compared with the first variable, and if the first variable is less than the current pixel value, returning to the step of comparing the first variable with the current pixel which is not compared with the first variable.
The pixel value of the coding block to be processed by the second variable is similar to the traversal step corresponding to the first variable, and is not described herein again.
S303, calculating an average value abshv of absolute differences between pixel values of odd lines and pixel values of adjacent even lines in the obtained pixel values according to the following expression according to the obtained pixel values blk (i, j) of the coding block to be processed;
the expression is as follows:
Figure BDA0001544451950000151
w is the width of the coding block to be processed, h is the height of the coding block to be processed, w and h are both even numbers, i is a row where a pixel value in the coding block to be processed is located, j is a column where the pixel value in the coding block to be processed is located, i and j are both natural numbers, and abs (·) is an absolute value function;
it should be noted that this step can quickly and readily calculate the average value of the absolute differences between the pixel values of the odd rows and the pixel values of the next adjacent even rows in the coding block to be processed according to the above expression.
S304, judging whether the calculated average value is smaller than a third threshold value; if the average value is less than the third threshold, executing S305, and if the average value is greater than or equal to the third threshold, executing S307;
it should be noted that the down-sampling algorithm, i.e. down-sampling, is enabled only when the calculated average value, i.e. the gradient, is smaller than the third threshold value; the third threshold may be 42/16.
S305, down-sampling the target source block and the coding block to be processed to a preset proportion of the area of the target source block, and obtaining the down-sampled coding block to be processed and the target source block;
wherein the preset ratio may be 1/2.
It should be noted that, if the predetermined ratio is 1/2, the down-sampling in this step is to reduce the pixel value of the reconstructed block, i.e. the coding block to be processed, to half of the target source block, thereby saving half of the calculation amount compared to the prior art.
It should be noted that, in this step, both the target source block and the reconstructed block are downsampled, and downsampling is performed for the coding block to be processed whose average value is smaller than the third threshold.
S306, taking the code block to be processed after down-sampling as a new code block to be processed, and returning to the step of executing the S301;
the return execution S301 is the execution of S301 to S306.
S307, aiming at each target index number, calculating the target offset of the coding block to be processed in the band corresponding to the first target index number according to the pixel values of the coding block to be processed and the target source block respectively positioned in the band corresponding to the first target index number, wherein the first threshold is the minimum pixel value divided by the preset value, the second threshold is the maximum pixel value divided by the preset value, the target index number is a number corresponding to a first preset number of bands, the target index number is greater than the first threshold and less than the second threshold, the system comprises a band, a target source block and a target offset, wherein the band is used for identifying coding block pixels to be processed of coding blocks to be processed or within which band source block pixels of the source block are distributed, the target source block is a source block corresponding to the coding blocks to be processed, a first target index number is any one of a first preset number of target index numbers, and the target offset of the coding blocks to be processed is the optimal offset output within the band corresponding to the first target index number;
s307 to S308 are the same as the methods performed by S103 to S104 in the embodiment of fig. 2. Therefore, all the embodiments in fig. 2 are applicable to fig. 4, and can achieve the same or similar beneficial effects, and are not described herein again.
S308, determining an optimal starting value by a method of calculating rate distortion cost by using the calculated target offset, and determining a second preset number of offsets by using the optimal starting value.
Therefore, the band mode determining method provided by the embodiment of the present invention obtains the average value to be obtained quickly and in preparation as shown in the above expression, and down-samples the target source block and the coding block to be processed to the preset proportion of the area of the target source block for the coding block to be processed whose calculated average value is smaller than the third threshold, and the down-sampling directly saves the calculation of the burden preset proportion for calculating the target offset of each band, and only needs to calculate the target offset of each target index number corresponding to the band in the range smaller than the first threshold and larger than the second threshold by using the down-sampled coding block to be processed and target source block, and the rest offsets are set to 0, and not only reduces the complexity of the band mode, but also further improves the coding speed by determining an optimal start value and determining a second preset number of offsets by using the optimal start value.
Corresponding to the band mode-based determination method, the embodiment of the invention also provides a band mode determination device.
The embodiment of the invention also provides a band mode determining device. Referring to fig. 5, fig. 5 is a block diagram of a band mode determining apparatus according to an embodiment of the present invention, the apparatus including:
a pixel value obtaining module 401, configured to scan the obtained coding block to be processed, and obtain a pixel value of the coding block to be processed;
a pixel value determining module 402, configured to determine a maximum pixel value and a minimum pixel value of the coding block to be processed by using the size of the pixel value of the coding block to be processed;
a target offset calculation module 403, configured to calculate, for each target index number that is smaller than a first threshold and larger than a second threshold, a target offset of the to-be-processed coding block within a band corresponding to the first target index number according to pixel values of the to-be-processed coding block and the target source block that are respectively located within the band corresponding to the first target index number, where the target index number is a number corresponding to a first preset number of bands and is used to identify in which band the to-be-processed coding block pixels or the target source block pixels are distributed, the first target index number is any one of the first preset number of target index numbers, and the target offset is an optimal offset output within the band corresponding to the first target index number;
a first offset determining module 404, configured to determine an optimal starting value by using the calculated target offsets, and determine a second preset number of offsets by using the optimal starting value.
Wherein, the device can also include:
the average value calculating module is used for calculating the average value of absolute differences between the pixel values of the odd lines and the pixel values of the adjacent even lines in the obtained pixel values by using the pixel values of the coding blocks to be processed, and the line number value corresponding to the odd line is smaller than the line number value corresponding to the adjacent even line;
the judging module is used for judging whether the calculated average value is smaller than a third threshold value; if the sampling rate is less than the preset threshold, triggering a down-sampling module;
the down-sampling module is used for down-sampling the target source block and the coding block to be processed to a preset proportion of the area of the target source block to obtain the down-sampled coding block to be processed and the target source block;
and the downsampling obtaining module is used for triggering the pixel value obtaining module by taking the downsampled coding block to be processed as a new coding block to be processed.
The average value calculation module includes:
the calculation submodule is used for calculating an average value abshv of absolute differences between pixel values of odd lines and pixel values of adjacent even lines in the obtained pixel values according to the following expression according to the obtained pixel values blk (i, j) of the coding blocks to be processed;
the expression is as follows:
Figure BDA0001544451950000181
w is the width of the coding block to be processed, h is the height of the coding block to be processed, w and h are both even numbers, i is a row where a pixel value in the coding block to be processed is located, j is a column where the pixel value in the coding block to be processed is located, i and j are both natural numbers, and abs (·) is an absolute value function.
The pixel value determining module 402 includes:
and the traversal module is used for traversing the pixel values of the coding blocks to be processed and obtaining the maximum pixel value and the minimum pixel value of the coding blocks to be processed by comparing the pixel values of the coding blocks to be processed.
The pixel value determination module includes:
the first sequencing submodule is used for sequencing the pixel values of the coding blocks to be processed according to the sizes to obtain a sequence after the pixel values of the coding blocks to be processed are sequenced;
and the selection submodule is used for selecting the maximum pixel value and the minimum pixel value from the sequence.
The first ordering submodule includes:
and the second sequencing unit is used for sequencing the pixel values of the coding blocks to be processed from large to small to obtain a sequence after the pixel values of the coding blocks to be processed are sequenced.
The offset determination module 404 includes:
and the second offset determining submodule is used for determining an optimal starting value by a method of calculating rate distortion cost by using the calculated target offset, and determining a second preset number of offsets by using the optimal starting value.
Wherein the third threshold is 42/16.
Therefore, the band mode determining apparatus provided in the embodiment of the present invention does not need to calculate the target offset of each band, but only calculates the target offset of each band corresponding to each target index number in a range smaller than the first threshold and larger than the second threshold, and sets the remaining offsets to 0, and determines a second preset number of offsets by determining an optimal starting value and using the optimal starting value, so that the method reduces the complexity of the band mode and further increases the encoding speed.
The embodiment of the present invention further provides an electronic device, as shown in fig. 6, which includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502 and the memory 503 complete mutual communication through the communication bus 504,
a memory 503 for storing a computer program;
the processor 501 is configured to implement the band mode determining method provided by the embodiment of the present invention when executing the program stored in the memory 503.
Specifically, the band mode determining method includes:
scanning the obtained coding block to be processed to obtain a pixel value of the coding block to be processed;
determining the maximum pixel value and the minimum pixel value of the coding block to be processed by using the size of the pixel value of the coding block to be processed;
for each target index number which is smaller than a first threshold and larger than a second threshold, calculating a target offset of the coding block to be processed in a band corresponding to the first target index number according to pixel values of the coding block to be processed and the target source block which are respectively located in the band corresponding to the first target index number, wherein the first threshold is a minimum pixel value divided by a preset value, the second threshold is a maximum pixel value divided by a preset value, the target index number is a number corresponding to a first preset number of bands and is used for identifying in which band the coding block pixels or the target source block pixels to be processed are distributed, the first target index number is any one of the first preset number of target index numbers, and the target offset is an optimal offset output in the band corresponding to the first target index number;
an optimal starting value is determined using the calculated target offset values, and a second predetermined number of offset values are determined using the optimal starting value.
Therefore, by executing the electronic device provided by the embodiment, the target offset of each band is not required to be calculated, only the target offset of each band corresponding to each target index number in the range smaller than the first threshold and larger than the second threshold is calculated, the rest offsets are set to 0, and by determining an optimal starting value and determining a second preset number of offsets by using the optimal starting value, the complexity of the band mode is reduced, and the encoding speed is further increased.
The implementation of the above-mentioned related content band mode determination method is the same as the band mode determination method provided in the foregoing method embodiment section, and is not described here again.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
In yet another embodiment provided by the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute the band mode determination method of any of the above embodiments.
In a further embodiment provided by the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the band mode determination method of any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for apparatus, device, computer-readable storage medium, or computer program product embodiments, as they are substantially similar to method embodiments, the description is relatively simple, and reference may be made to some descriptions of method embodiments for related matters.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (17)

1. A band mode determination method, comprising:
scanning the obtained coding block to be processed to obtain a pixel value of the coding block to be processed;
determining the maximum pixel value and the minimum pixel value of the coding block to be processed by utilizing the size of the pixel value of the coding block to be processed;
aiming at each target index number, calculating the target offset of the coding block to be processed in the band corresponding to the first target index number according to the pixel values of the coding block to be processed and the target source block respectively positioned in the band corresponding to the first target index number, wherein the first threshold is the minimum pixel value divided by a preset value, the second threshold is the maximum pixel value divided by a preset value, the target index number is a number corresponding to a first preset number of bands, the target index number is greater than a first threshold value and less than a second threshold value, for identifying within which band the encoded block pixels to be processed or the source block target source block pixels are distributed, the target source block is a source block corresponding to the coding block to be processed, the first target index number is any one of a first preset number of target index numbers, the target offset of the coding block to be processed is the optimal offset output in the band corresponding to the first target index number; calculating a target offset of the to-be-processed coding block in the band corresponding to the first target index number comprises: calculating target offset of each target index number corresponding to the band in a range smaller than the first threshold and larger than the second threshold, and setting the rest optimal offset as 0; the source block is a coding block before the input video or image is coded, and the coding block to be processed is a coded source block;
an optimal starting value is determined using the calculated target offset values, and a second predetermined number of offset values are determined using the optimal starting value.
2. The method of claim 1, wherein after or before said determining a maximum pixel value and a minimum pixel value for the coding block to be processed using a size of pixel values for the coding block to be processed, the method further comprises:
calculating the average value of absolute differences between the pixel values of the odd rows and the pixel values of the adjacent even rows in the obtained pixel values by using the pixel values of the coding blocks to be processed, wherein the row number value corresponding to the odd row is smaller than the row number value corresponding to the adjacent even row;
judging whether the calculated average value is smaller than a third threshold value;
if the average value is smaller than the third threshold value, both the target source block and the coding block to be processed are down-sampled to a preset proportion of the area of the target source block, and the down-sampled coding block to be processed and the target source block are obtained;
and taking the code block to be processed after the down sampling as a new code block to be processed, and returning to the step of scanning the obtained code block to be processed to obtain the pixel value of the code block to be processed.
3. The method of claim 2, wherein said calculating an average of absolute differences between odd row pixel values and adjacent even row pixel values in the acquired pixel values comprises:
calculating an average value abshv of absolute differences between pixel values of odd lines and pixel values of adjacent even lines in the obtained pixel values according to the obtained pixel values blk (i, j) of the coding block to be processed and the following expression;
the expression is as follows:
Figure FDA0002390680600000021
w is the width of the coding block to be processed, h is the height of the coding block to be processed, w and h are even numbers, i is a row where a pixel value in the coding block to be processed is located, j is a column where the pixel value in the coding block to be processed is located, i and j are natural numbers, and abs (·) is an absolute value function.
4. The method of any one of claims 1-3, wherein the determining a maximum pixel value and a minimum pixel value for the coding block to be processed using the size of the pixel value for the coding block to be processed comprises:
and traversing the pixel values of the coding blocks to be processed, and comparing the pixel values of the coding blocks to be processed to obtain the maximum pixel value and the minimum pixel value of the coding blocks to be processed.
5. The method of any one of claims 1-3, wherein the determining a maximum pixel value and a minimum pixel value for the coding block to be processed using the size of the pixel value for the coding block to be processed comprises:
sorting the pixel values of the coding blocks to be processed according to the sizes to obtain a sequence after the pixel values of the coding blocks to be processed are sorted;
-selecting the maximum pixel value and the minimum pixel value from the sequence.
6. The method of claim 5, wherein said sorting the pixel values of the to-be-processed coded blocks by size to obtain a sorted sequence of pixel values of the to-be-processed coded blocks comprises:
and sequencing the pixel values of the coding blocks to be processed from large to small to obtain a sequence after the pixel values of the coding blocks to be processed are sequenced.
7. The method of claim 6, wherein determining an optimal starting value and using the optimal starting value to determine a second predetermined number of offsets comprises:
and determining an optimal starting value by using the calculated target offset and calculating the rate distortion cost, and determining a second preset number of offsets by using the optimal starting value.
8. The method of claim 2, wherein the third threshold is 42/16.
9. A band mode determining apparatus, comprising:
the device comprises a pixel value obtaining module, a coding block processing module and a processing module, wherein the pixel value obtaining module is used for scanning an obtained coding block to be processed to obtain a pixel value of the coding block to be processed;
the pixel value determining module is used for determining the maximum pixel value and the minimum pixel value of the coding block to be processed by utilizing the size of the pixel value of the coding block to be processed;
a target offset calculation module, configured to calculate, for each target index number, a target offset of the to-be-processed coding block in a band corresponding to a first target index number according to pixel values of the to-be-processed coding block and the target source block that are respectively located in the band corresponding to the first target index number, wherein the first threshold is the minimum pixel value divided by a preset value, the second threshold is the maximum pixel value divided by a preset value, the target index number is a number corresponding to a first preset number of bands, the target index number is greater than a first threshold value and less than a second threshold value, for identifying within which band the encoded block pixels or target source block pixels to be processed are distributed, the first target index number is any one of a first preset number of target index numbers, the target source block is a source block corresponding to the coding block to be processed, and the target offset is an optimal offset output in a band corresponding to a first target index number; calculating a target offset of the to-be-processed coding block in the band corresponding to the first target index number comprises: calculating target offset of each target index number corresponding to the band in a range smaller than the first threshold and larger than the second threshold, and setting the rest optimal offset as 0; the source block is a coding block before the input video or image is coded, and the coding block to be processed is a coded source block;
and the first offset determining module is used for determining an optimal starting value by utilizing the calculated target offset and determining a second preset number of offsets by utilizing the optimal starting value.
10. The apparatus of claim 9, wherein the apparatus further comprises:
the average value calculating module is used for calculating the average value of absolute differences between the pixel values of the odd lines and the pixel values of the adjacent even lines in the obtained pixel values by using the pixel values of the coding blocks to be processed, and the line number value corresponding to the odd line is smaller than the line number value corresponding to the adjacent even line;
the judging module is used for judging whether the calculated average value is smaller than a third threshold value; if the average value is smaller than the third threshold value, triggering a down-sampling module;
the down-sampling module is used for down-sampling the target source block and the coding block to be processed to a preset proportion of the area of the target source block to obtain the down-sampled coding block to be processed and the target source block;
and the downsampling obtaining module is used for taking the downsampled coding block to be processed as a new coding block to be processed and triggering the pixel value obtaining module.
11. The apparatus of claim 10, wherein the mean computation module comprises:
the calculation submodule is used for calculating an average value abshv of absolute differences between pixel values of odd lines and pixel values of adjacent even lines in the obtained pixel values according to the following expression according to the obtained pixel values blk (i, j) of the coding block to be processed;
the expression is as follows:
Figure FDA0002390680600000041
w is the width of the coding block to be processed, h is the height of the coding block to be processed, w and h are even numbers, i is a row where a pixel value in the coding block to be processed is located, j is a column where the pixel value in the coding block to be processed is located, i and j are natural numbers, and abs (·) is an absolute value function.
12. The apparatus of any one of claims 9-11, wherein the pixel value determination module comprises:
and the traversing module is used for traversing the pixel values of the coding blocks to be processed and obtaining the maximum pixel value and the minimum pixel value of the coding blocks to be processed by comparing the pixel values of the coding blocks to be processed.
13. The apparatus of any one of claims 9-11, wherein the pixel value determination module comprises:
the first sequencing submodule is used for sequencing the pixel values of the coding blocks to be processed according to the sizes to obtain a sequence after the pixel values of the coding blocks to be processed are sequenced;
a selection submodule for selecting the maximum pixel value and the minimum pixel value from the sequence.
14. The apparatus of claim 13, wherein the first ordering submodule comprises:
and the second sequencing unit is used for sequencing the pixel values of the coding blocks to be processed from large to small to obtain a sequence after the pixel values of the coding blocks to be processed are sequenced.
15. The apparatus of claim 14, wherein the first offset determination module comprises:
and the second offset determining submodule is used for determining an optimal starting value by a method of calculating rate distortion cost by using the calculated target offset, and determining a second preset number of offsets by using the optimal starting value.
16. The apparatus of claim 10, in which the third threshold is 42/16.
17. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 8 when executing a program stored in the memory.
CN201810024207.0A 2018-01-10 2018-01-10 Band mode determination method and device Active CN108235021B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810024207.0A CN108235021B (en) 2018-01-10 2018-01-10 Band mode determination method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810024207.0A CN108235021B (en) 2018-01-10 2018-01-10 Band mode determination method and device

Publications (2)

Publication Number Publication Date
CN108235021A CN108235021A (en) 2018-06-29
CN108235021B true CN108235021B (en) 2020-06-19

Family

ID=62640404

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810024207.0A Active CN108235021B (en) 2018-01-10 2018-01-10 Band mode determination method and device

Country Status (1)

Country Link
CN (1) CN108235021B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103220510A (en) * 2012-01-20 2013-07-24 索尼公司 Flexible band offset mode in sample adaptive offset in HEVC
CN103442229A (en) * 2013-08-27 2013-12-11 复旦大学 Bit rate estimation method of SAO mode decision applied to encoder of HEVC standard
CN103647975A (en) * 2013-12-02 2014-03-19 国家广播电影电视总局广播科学研究院 Improved sample adaptive offset filtering method based on histogram analysis
EP2869554A1 (en) * 2012-06-27 2015-05-06 Panasonic Intellectual Property Corporation of America Image coding method, image decoding method, image coding device, image decoding device, and image coding and decoding apparatus
CN104641640A (en) * 2012-07-16 2015-05-20 三星电子株式会社 Video encoding method and video encoding apparatus and video decoding method and video decoding apparatus for signaling SAO parameter

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014207536A (en) * 2013-04-12 2014-10-30 ソニー株式会社 Image processing device and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103220510A (en) * 2012-01-20 2013-07-24 索尼公司 Flexible band offset mode in sample adaptive offset in HEVC
EP2869554A1 (en) * 2012-06-27 2015-05-06 Panasonic Intellectual Property Corporation of America Image coding method, image decoding method, image coding device, image decoding device, and image coding and decoding apparatus
CN104641640A (en) * 2012-07-16 2015-05-20 三星电子株式会社 Video encoding method and video encoding apparatus and video decoding method and video decoding apparatus for signaling SAO parameter
CN103442229A (en) * 2013-08-27 2013-12-11 复旦大学 Bit rate estimation method of SAO mode decision applied to encoder of HEVC standard
CN103647975A (en) * 2013-12-02 2014-03-19 国家广播电影电视总局广播科学研究院 Improved sample adaptive offset filtering method based on histogram analysis

Also Published As

Publication number Publication date
CN108235021A (en) 2018-06-29

Similar Documents

Publication Publication Date Title
CN109005408B (en) Intra-frame prediction method and device and electronic equipment
CN110839155B (en) Method and device for motion estimation, electronic equipment and computer-readable storage medium
KR101208863B1 (en) Selecting encoding types and predictive modes for encoding video data
US20200374526A1 (en) Method, device, apparatus for predicting video coding complexity and storage medium
US20190327481A1 (en) Intra-prediction video coding method and device
WO2019085942A1 (en) Sao mode decision-making method, apparatus, electronic device and readable storage medium
US20170353720A1 (en) Prediction mode selection method, apparatus and device
JP2009509418A (en) Classification filtering for temporal prediction
US8369639B2 (en) Image processing apparatus, computer readable medium storing program, method and computer data signal for partitioning and converting an image
CN111669593B (en) Video encoding method, video encoding device, electronic equipment and storage medium
CN116033149A (en) Method and device for predicting video image component and computer storage medium
KR100845209B1 (en) Method and apparatus for selecting intra prediction mode
US20190246119A1 (en) Interframe predictive coding method and device
CN110956594A (en) Image filtering method and device, electronic equipment and storage medium
US10129565B2 (en) Method for processing high dynamic range video in order to improve perceived visual quality of encoded content
CN115022635A (en) Star map compression method based on target detection
CN108235021B (en) Band mode determination method and device
CN109660806B (en) Encoding method and device and electronic equipment
CN113709494A (en) Image decompression method and device for super-resolution reconstruction
CN109544591B (en) Motion estimation method and device, electronic equipment and storage medium
CN101268623B (en) Method and device for creating shape variable blocks
CN109951707B (en) Target motion vector selection method and device, electronic equipment and medium
WO2017214920A1 (en) Intra-frame prediction reference pixel point filtering control method and device, and coder
CN105706447A (en) Moving image coding device, moving image decoding device, moving image coding method, moving image decoding method, and program
CN107172425B (en) Thumbnail generation method and device and terminal equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant