Embodiment:
Accompanying drawing 1 shows the coding and decoding device of existing block-removal filtering method, comprises filtering strength decision device and the deblocking filtering apparatus that is used for macro block data is carried out block elimination filtering.Accompanying drawing 2 shows existing block-removal filtering method 4 * 4 levels or vertical boundary is carried out the related sampled pixel point of block elimination filtering.Wherein, thick lines represent to carry out the block boundary of block elimination filtering, p
0, p
1, p
2, p
3, q
0, q
1, q
2, q
3Each 4 sampled pixel point of expression block boundary both sides.Accompanying drawing 3 shows existing block-removal filtering method block boundary is carried out the block boundary deblocking filtering apparatus of block elimination filtering, p
0, p
1, p
2, p
3, q
0, q
1, q
2, q
3Expression is input to 8 sampled pixel points of block boundary deblocking filtering apparatus, P
0, P
1, P
2, Q
0, Q
1, Q
2Represent former sample pixel p
0, p
1, p
2, q
0, q
1, q
2Through the pixel value behind the block boundary block elimination filtering.
Codec is according to macro block (mb) type, and information such as macroblock coding residual sum motion vector are adjudicated current filtering strength, and according to filtering strength the input macro block data is carried out block elimination filtering and output.Existing block-removal filtering method needs each 4 sampled pixel point of block boundary both sides when 4 * 4 levels or vertical boundary are carried out block elimination filtering.
The weak point of existing method is that the needed information of judgement filtering strength is many, the condition judgment more complicated that relates to, and also related number of pixels is many at every turn when carrying out block elimination filtering, is difficult to parallel processing.Below at the deficiency of existing method, and present invention will be described in detail with reference to the accompanying.
Embodiment 1
Accompanying drawing 4 shows a kind of coding and decoding device that applies to video or image block elimination filtering, comprises the filter patterns decision device, is used for macro block data is carried out the deblocking filtering apparatus of block elimination filtering and is used for the TDMD time division multiplex device that timesharing is exported.The block-removal filtering method that accompanying drawing 5 shows the present invention's employing carries out the related sampled pixel point of block elimination filtering to 4 * 4 levels or vertical boundary.Wherein, thick lines represent to carry out the block boundary of block elimination filtering, p
0, p
1, q
0, q
1Each 2 sampled pixel point of expression block boundary both sides.Accompanying drawing 6 shows existing block-removal filtering method block boundary is carried out the block boundary deblocking filtering apparatus of block elimination filtering, p
0, p
1, q
0, q
1Expression is input to 4 sampled pixel points of block boundary deblocking filtering apparatus, P
0, P
1, Q
0, Q
1Represent former sample pixel p
0, p
1, q
0, q
1Through the pixel value behind the block boundary block elimination filtering.
Codec is according to macro block (mb) type, quantization parameter, and the quantization parameter threshold value is adjudicated current filter patterns, and according to filter patterns the input macro block data is carried out block elimination filtering and output.The block-removal filtering method that the present invention adopts needs each 2 sampled pixel point of block boundary two ends when 4 * 4 levels or vertical boundary are carried out block elimination filtering.
One, according to the quantization parameter CurrentQP of macro block (mb) type and macro block, determine the macro block filtering pattern by the following method:
(1) if current macro is an inter-coded macroblocks, then the macro block filtering pattern is the intra-frame macro block pattern;
(2) otherwise, if current macro is the skip mode coded macroblocks, and macroblock quantization parameter is less than a certain quantization parameter threshold value, then the macro block filtering pattern is filtered macroblock pattern not, this not filtering of macro block.Wherein, the quantization parameter threshold value equals quantization parameter threshold value default value or determines jointly that by quantization parameter threshold shift and quantization parameter threshold value default value the quantization parameter threshold shift can transmit, and also can transmit by other mode in encoding code stream;
(3) otherwise, the macro block filtering pattern is an inter macroblock.
Two, the derivation of block boundary threshold value
Accompanying drawing 4 expression piece p and piece q are at 4 sampled pixel points of level or vertical boundary both sides.Use P
0, P
1, Q
0And Q
1Represent sampled pixel point p respectively
0, p
1, q
0And q
1Carry out the pixel value behind the block elimination filtering.
If this macro block need carry out block elimination filtering, and following formula is true, then block boundary carried out block elimination filtering:
Abs(p
0-q
0)<α
Function Abs is defined as:
Wherein α is the block boundary threshold value, can be according to the mean value CurrentQP of the quantization parameter CurrentQP of two pieces
Av, and the skew AlphaCIOffset lookup table index IndexA of block boundary threshold value and intra-frame macro block filtering cutting coefficient index.
CurrentQP
AvFor:
CurrentQP
av=(CurrentQP
p+CurrentQP
q+1)>>1
Index IndexA is:
IndexA=Clip3(0,63,CurrentQP
av+AlphaCIOffset)
Function C lip3 is defined as:
According to the corresponding relation between index IndexA and threshold alpha, obtain the α value by table 1.
Table 1: the relation of block boundary threshold alpha and IndexA
Index | ????α |
????0 | ????0 |
????1 | ????0 |
????2 | ????0 |
????3 | ????0 |
????4 | ????0 |
????5 | ????0 |
????6 | ????1 |
????7 | ????1 |
????8 | ????1 |
????9 | ????1 |
????10 | ????1 |
????11 | ????2 |
????12 | ????2 |
????13 | ????2 |
????14 | ????3 |
????15 | ????3 |
Index | ??α |
??16 | ??4 |
??17 | ??4 |
??18 | ??5 |
??19 | ??5 |
??20 | ??6 |
??21 | ??7 |
??22 | ??8 |
??23 | ??9 |
??24 | ??10 |
??25 | ??11 |
??26 | ??12 |
??27 | ??13 |
??28 | ??15 |
??29 | ??16 |
??30 | ??18 |
??31 | ??20 |
Index | ??α |
????32 | ??22 |
????33 | ??24 |
????34 | ??26 |
????35 | ??28 |
????36 | ??30 |
????37 | ??33 |
????38 | ??33 |
????39 | ??35 |
????40 | ??35 |
????41 | ??36 |
????42 | ??37 |
????43 | ??37 |
????44 | ??39 |
????45 | ??39 |
????46 | ??42 |
????47 | ??44 |
Index | ??α |
??48 | ??46 |
??49 | ??48 |
??50 | ??50 |
??51 | ??52 |
??52 | ??53 |
??53 | ??54 |
??54 | ??55 |
??55 | ??56 |
??56 | ??57 |
??57 | ??58 |
??58 | ??59 |
??59 | ??60 |
??60 | ??61 |
??61 | ??62 |
??62 | ??63 |
??63 | ??64 |
Three, the block elimination filtering process of intra-frame macro block filter patterns
Sampled pixel point p to luminance block or both sides, chrominance block border
0, p
1, q
0And q
1Carry out block elimination filtering, the block elimination filtering process is as follows: at first according to the macro block filtering cutting coefficient of intra-frame macro block filter patterns correspondence, picture material obtains each pixel filter variable quantity that participates in the pixel correspondence of block elimination filtering process; Then, the pixel original value adds that the pixel filter variable quantity is the pixel value of block elimination filtering gained.
delta=Clip3(-CI,CI,(((q0-p0)×4+(p1-q1)+4)>>3) delta1=delta>>1 if(p1==p0) { P0=Clip1(p0+delta) P1=Clip1(p1+delta1) } else P0=Clip1(p0+delta1) if(q1==q0) { <!-- SIPO <DP n="5"> --> <dp n="d5"/> Q0=Clip1(q0-delta) Q1=Clip1(q1-delta1) } else Q0=Clip1(q0-delta1)
In the above-mentioned block elimination filtering process, delta, delta1 are respectively sampled pixel point p
0, q
0And p
1, q
1Corresponding filtering pixel increment.Function C lip1 is defined as: and Clip1 (x)=Clip3 (0,255, x).CI is called intra-frame macro block filtering cutting coefficient.Relation between CI and the IndexCI is referring to table 2.Wherein IndexCI is an intra-frame macro block filtering cutting coefficient index, is defined as follows:
IndexCI=Clip3(0,63,QP
av)
The relation of table 2:CI and IndexCI
IndexCI | ??CI |
????0 | ??0 |
????1 | ??0 |
????2 | ??0 |
????3 | ??0 |
????4 | ??0 |
????5 | ??0 |
????6 | ??0 |
????7 | ??0 |
????8 | ??0 |
????9 | ??0 |
????10 | ??0 |
????11 | ??0 |
????12 | ??0 |
????13 | ??0 |
????14 | ??0 |
????15 | ??0 |
??IndexCI | ??CI |
????16 | ??0 |
????17 | ??0 |
????18 | ??0 |
????19 | ??0 |
????20 | ??0 |
????21 | ??0 |
????22 | ??1 |
????23 | ??1 |
????24 | ??1 |
????25 | ??1 |
????26 | ??1 |
????27 | ??1 |
????28 | ??1 |
????29 | ??2 |
????30 | ??2 |
????31 | ??2 |
?IndexCI | ??CI |
????32 | ??2 |
????33 | ??2 |
????34 | ??2 |
????35 | ??3 |
????36 | ??4 |
????37 | ??4 |
????38 | ??4 |
????39 | ??4 |
????40 | ??5 |
????41 | ??5 |
????42 | ??5 |
????43 | ??5 |
????44 | ??5 |
????45 | ??6 |
????46 | ??6 |
????47 | ??6 |
?IndexCI | ????CI |
????48 | ????6 |
????49 | ????7 |
????50 | ????7 |
????51 | ????8 |
????52 | ????9 |
????53 | ????9 |
????54 | ????10 |
????55 | ????11 |
????56 | ????12 |
????57 | ????13 |
????58 | ????14 |
????59 | ????15 |
????60 | ????16 |
????61 | ????16 |
????62 | ????16 |
????63 | ????16 |
Four, the block elimination filtering process of inter macroblocks filter patterns
Sampled pixel point p to luminance block or both sides, chrominance block border
0, p
1, q
0And q
1Carry out block elimination filtering, the block elimination filtering process is as follows: at first according to the macro block filtering cutting coefficient of inter macroblocks filter patterns correspondence, picture material obtains each pixel filter variable quantity that participates in the pixel correspondence of block elimination filtering process; Then, the pixel original value adds that the pixel filter variable quantity is the pixel value of block elimination filtering gained.
delta=Clip3(-CP,CP,(((q0-p0)×4+(p1-q1)+4)>>3) <!-- SIPO <DP n="6"> --> <dp n="d6"/> delta1=delta>>1 if((p1==p0)&&(Abs(p0-q0)<((α>>2)+2))) { P0=Clip1(p0+delta) P1=Clip1(p1+delta1) } else P0=Clip1(p0+delta1) if((q1==q0)&&(Abs(p0-q0)<(α>>2)+2))) { Q0=Clip1(q0-delta) Q1=Clip1(q1-deltal) } else Q0=Clip1(q0-delta1)
In the above-mentioned block elimination filtering process, CP is called inter macroblocks filtering cutting coefficient, and CP and CI can be derived mutually by formula and draw, and can be expressed as: (CI, CPOffset), wherein f () is specific function to CP=f, for example: CP=(CI>>1)+CPOffset
Wherein CPOffset is the skew of inter macroblocks filtering cutting coefficient.The skew of inter macroblocks filtering cutting coefficient can transmit in encoding code stream, also can transmit by other mode.
Embodiment 2
Accompanying drawing 4 shows a kind of coding and decoding device that applies to video or image block elimination filtering, comprises the filter patterns decision device, is used for macro block data is carried out the deblocking filtering apparatus of block elimination filtering and is used for the TDMD time division multiplex device that timesharing is exported.The block-removal filtering method that accompanying drawing 5 shows the present invention's employing carries out the related sampled pixel point of block elimination filtering to 4 * 4 levels or vertical boundary.Wherein, thick lines represent to carry out the block boundary of block elimination filtering, p
0, p
1, q
0, q
1Each 2 sampled pixel point of expression block boundary both sides.Accompanying drawing 6 shows existing block-removal filtering method block boundary is carried out the block boundary deblocking filtering apparatus of block elimination filtering, p
0, p
1, q
0, q
1Expression is input to 4 sampled pixel points of block boundary deblocking filtering apparatus, P
0, P
1, Q
0, Q
1Represent former sample pixel p
0, p
1, q
0, q
1Through the pixel value behind the block boundary block elimination filtering.
Codec is according to macro block (mb) type, quantization parameter, and the quantization parameter threshold value is adjudicated current filter patterns, and according to filter patterns the input macro block data is carried out block elimination filtering and output.The block-removal filtering method that the present invention adopts needs each 2 sampled pixel point of block boundary two ends when 4 * 4 levels or vertical boundary are carried out block elimination filtering.
One, according to the quantization parameter CurrentQP of macro block (mb) type and macro block, determine the macro block filtering pattern by the following method:
(1) if current macro is an inter-coded macroblocks, then the macro block filtering pattern is the intra-frame macro block pattern;
(2) otherwise, if current macro is the skip mode coded macroblocks, and macroblock quantization parameter is less than a certain quantization parameter threshold value, then the macro block filtering pattern is filtered macroblock pattern not, this not filtering of macro block.Wherein, the quantization parameter threshold value equals quantization parameter threshold value default value or determines jointly that by quantization parameter threshold shift and quantization parameter threshold value default value the quantization parameter threshold shift can transmit, and also can transmit by other mode in encoding code stream;
(3) otherwise, the macro block filtering pattern is an inter macroblock.
Two, the derivation of block boundary threshold value
Accompanying drawing 4 expression piece p and piece q are at 4 sampled pixel points of level or vertical boundary both sides.Use P
0, P
1, Q
0And Q
1Represent sampled pixel point p respectively
0, p
1, q
0And q
1Carry out the pixel value behind the block elimination filtering.
If this macro block need carry out block elimination filtering, and following formula is true, then block boundary carried out block elimination filtering:
Abs(p
0-q
0)<α
Function Abs is defined as:
Wherein α is the block boundary threshold value, can be according to the mean value CurrentQP of the quantization parameter CurrentQP of two pieces
Av, and the skew AlphaCIOffset lookup table index IndexA of block boundary threshold value and intra-frame macro block filtering cutting coefficient index.
CurrentQP
AvFor:
CurrentQP
av=(CurrentQP
p+CurrentQP
q+1)>>1
Index IndexA is:
IndexA=Clip3(0,63,CurrentQP
av+AlphaCIOffset)
Function C lip3 is defined as:
According to the corresponding relation between index IndexA and threshold alpha, obtain the α value by table 1.
Three, the block elimination filtering process of intra-frame macro block filter patterns
Sampled pixel point p to luminance block or both sides, chrominance block border
0, p
1, q
0And q
1Carry out block elimination filtering, the block elimination filtering process is as follows: at first according to the macro block filtering cutting coefficient of intra-frame macro block filter patterns correspondence, picture material obtains each pixel filter variable quantity that participates in the pixel correspondence of block elimination filtering process; Then, the pixel original value adds that the pixel filter variable quantity is the pixel value of block elimination filtering gained.
delta=Clip3(-CI,CI,(((q0-p0)×4+(p1-q1)+4)>>3) delta1=delta>>1 if(p1==p0) { P0=Clip1(p0+delta) P1=Clip1(p1+delta1) } else P0=Clip1(p0+delta1) if(q1==q0) { Q0=Clip1(q0-delta) Q1=Clip1(q1-delta1) } else Q0=Clip1(q0-delta1)
In the above-mentioned block elimination filtering process, delta, delta1 are respectively sampled pixel point p
0, q
0And p
1, q
1Corresponding filtering pixel increment.Function C lip1 is defined as: and Clip1 (x)=Clip3 (0,255, x).CI is called intra-frame macro block filtering cutting coefficient.Relation between CI and the IndexCI is referring to table 2.Wherein IndexCI is an intra-frame macro block filtering cutting coefficient index, is defined as follows:
IndexCI=Clip3(0,63,QP
av)
Four, the block elimination filtering process of inter macroblocks filter patterns
Sampled pixel point p to luminance block or both sides, chrominance block border
0, p
1, q
0And q
1Carry out block elimination filtering, the block elimination filtering process is as follows: at first according to the macro block filtering cutting coefficient of inter macroblocks filter patterns correspondence, picture material obtains each pixel filter variable quantity that participates in the pixel correspondence of block elimination filtering process; Then, the pixel original value adds that the pixel filter variable quantity is the pixel value of block elimination filtering gained.
delta=Clip3(-CP,CP,(((q0-p0)×4+(p1-q1)+4)>>3) delta1=delta>>1 if((p1==p0)&&(Abs(p0-q0)<((α>>2)+2))) <!-- SIPO <DP n="9"> --> <dp n="d9"/> { P0=Clip1(p0+delta) P1=Clip1(p1+delta1) } else P0=Clip1(p0+delta1) if((q1==q0)&&(Abs(p0-q0)<(α>>2)+2))) { Q0=Clip1(q0-delta) Q1=Clip1(q1-delta1) } else Q0=Clip1(q0-delta1)
In the above-mentioned block elimination filtering process, CP is called inter macroblocks filtering cutting coefficient.Relation between CP and the IndexCP is referring to table 3.Wherein IndexCP is an inter macroblocks filtering cutting coefficient index, is defined as follows:
IndexCP=Clip3(0,63,QP
av)。
The relation of table 3:CP and IndexCP
IndexCP | ?CP |
????0 | ??0 |
????1 | ??0 |
????2 | ??0 |
????3 | ??0 |
????4 | ??0 |
????5 | ??0 |
????6 | ??0 |
????7 | ??0 |
????8 | ??0 |
????9 | ??0 |
????10 | ??0 |
????11 | ??0 |
????12 | ??0 |
????13 | ??0 |
????14 | ??0 |
????15 | ??0 |
?IndexCP | ??CP |
????16 | ??0 |
????17 | ??0 |
????18 | ??0 |
????19 | ??0 |
????20 | ??0 |
????21 | ??0 |
????22 | ??0 |
????23 | ??0 |
????24 | ??0 |
????25 | ??0 |
????26 | ??0 |
????27 | ??0 |
????28 | ??0 |
????29 | ??1 |
????30 | ??1 |
????31 | ??1 |
?IndexCP | ????CP |
????32 | ????1 |
????33 | ????1 |
????34 | ????1 |
????35 | ????1 |
????36 | ????2 |
????37 | ????2 |
????38 | ????2 |
????39 | ????2 |
????40 | ????2 |
????41 | ????2 |
????42 | ????2 |
????43 | ????2 |
????44 | ????2 |
????45 | ????3 |
????46 | ????3 |
????47 | ????3 |
?IndexCP | ????CP |
????48 | ????3 |
????49 | ????3 |
????50 | ????3 |
????51 | ????4 |
????52 | ????4 |
????53 | ????4 |
????54 | ????5 |
????55 | ????5 |
????56 | ????6 |
????57 | ????6 |
????58 | ????7 |
????59 | ????8 |
????60 | ????8 |
????61 | ????8 |
????62 | ????8 |
????63 | ????8 |
Embodiment 3
Accompanying drawing 4 shows a kind of coding and decoding device that applies to video or image block elimination filtering, comprises the filter patterns decision device, is used for macro block data is carried out the deblocking filtering apparatus of block elimination filtering and is used for the TDMD time division multiplex device that timesharing is exported.The block-removal filtering method that accompanying drawing 5 shows the present invention's employing carries out the related sampled pixel point of block elimination filtering to 4 * 4 levels or vertical boundary.Wherein, thick lines represent to carry out the block boundary of block elimination filtering, p
0, p
1, q
0, q
1Each 2 sampled pixel point of expression block boundary both sides.Accompanying drawing 6 shows existing block-removal filtering method block boundary is carried out the block boundary deblocking filtering apparatus of block elimination filtering, p
0, p
1, q
0, q
1Expression is input to 4 sampled pixel points of block boundary deblocking filtering apparatus, P
0, P
1, Q
0, Q
1Represent former sample pixel p
0, p
1, q
0, q
1Through the pixel value behind the block boundary block elimination filtering.
Codec is according to macro block (mb) type, quantization parameter, and the quantization parameter threshold value is adjudicated current filter patterns, and according to filter patterns the input macro block data is carried out block elimination filtering and output.The block-removal filtering method that the present invention adopts needs each 2 sampled pixel point of block boundary two ends when 4 * 4 levels or vertical boundary are carried out block elimination filtering.
One, according to the quantization parameter CurrentQP of macro block (mb) type and macro block, determine the macro block filtering pattern by the following method:
(1) if current macro is an inter-coded macroblocks, then the macro block filtering pattern is the intra-frame macro block pattern;
(2) otherwise, if current macro is the skip mode coded macroblocks, and macroblock quantization parameter is less than a certain quantization parameter threshold value, then the macro block filtering pattern is filtered macroblock pattern not, this not filtering of macro block.Wherein, the quantization parameter threshold value equals quantization parameter threshold value default value or determines jointly that by quantization parameter threshold shift and quantization parameter threshold value default value the quantization parameter threshold shift can transmit, and also can transmit by other mode in encoding code stream;
(3) otherwise, the macro block filtering pattern is an inter macroblock.
Two, the derivation of block boundary threshold value
Accompanying drawing 4 expression piece p and piece q are at 4 sampled pixel points of level or vertical boundary both sides.Use P
0, P
1, Q
0And Q
1Represent sampled pixel point p respectively
0, p
1, q
0And q
1Carry out the pixel value behind the block elimination filtering.
If this macro block need carry out block elimination filtering, and following formula is true, then block boundary carried out block elimination filtering:
f1(q
0,p
0,p
1,q
1)<0
Wherein, f1 (x
0, x
0, x
1, x
1) function judged of certain conditions of expression.
Three, the block elimination filtering process of intra-frame macro block filter patterns
Sampled pixel point p to luminance block or both sides, chrominance block border
0, p
1, q
0And q
1Carry out block elimination filtering, the block elimination filtering process is as follows: at first according to the macro block filtering cutting coefficient of intra-frame macro block filter patterns correspondence, picture material obtains each pixel filter variable quantity that participates in the pixel correspondence of block elimination filtering process; Then, obtain the pixel value of block elimination filtering gained according to pixel original value and pixel filter variable quantity.
delta=f2(CI,q
0,p
0,p
1,q
1)
P
0=f3(p
0,delta)
P
1=f4(p
1,delta)
Q
0=f5(q
0,delta)
Q
1=f6(q
1,deltal)
In the above-mentioned block elimination filtering process, f2 is a specific function, is used for obtaining the filter change amount, f3, and f4, f5, f6 are some specific functions, are used for to a p
0, p
1, q
0And q
1Carry out block elimination filtering.CI is called intra-frame macro block filtering cutting coefficient.Relation between CI and the IndexCI can be obtained by following formula:
CI=f7(IndexCI)。
Wherein f7 is a specific function, is used for obtaining CI, and IndexCI is an intra-frame macro block filtering cutting coefficient index, is defined as follows:
IndexCI=Clip3(0,63,QP
av)。
Four, the block elimination filtering process of inter macroblocks filter patterns
Sampled pixel point p to luminance block or both sides, chrominance block border
0, p
1, q
0And q
1Carry out block elimination filtering, the block elimination filtering process is as follows: at first according to the macro block filtering cutting coefficient of inter macroblocks filter patterns correspondence, picture material obtains each pixel filter variable quantity that participates in the pixel correspondence of block elimination filtering process; Then, obtain the pixel value of block elimination filtering gained according to pixel original value and pixel filter variable quantity.
delta=f2(CI,q
0,p
0,p
1,q
1)
P
0=f3(p
0,delta)
P
1=f4(p
1,delta)
Q
0=f5(q
0,delta)
Q
1=f6(q
1,delta1)
In the above-mentioned block elimination filtering process, f2 is a specific function, is used for obtaining the filter change amount, f3, and f4, f5, f6 are some specific functions, are used for to a p
0, p
1, q
0And q
1Carry out block elimination filtering.CP is called inter macroblocks filtering cutting coefficient.Relation between CP and the IndexCP can be obtained by following formula:
CP=f7(IndexCP)。
Wherein f7 is a specific function, is used for obtaining CP, and IndexCP is an inter macroblocks filtering cutting coefficient index, is defined as follows:
IndexCP=Clip3(0,63,QP
av)。
The foregoing description is used for the present invention that explains, rather than limits the invention, and in the protection range of spirit of the present invention and claim, any modification and change to the present invention makes all fall into protection scope of the present invention.