The method and apparatus of scan conversion coefficient in video or the image compression
Technical field
The present invention relates to a kind of electric numerical data treatment technology, especially, relate to a kind of method and apparatus that applies to the scan conversion coefficient of video or image compression.
Background technology
H.261 traditional video encoding standard such as the ITU of International Telecommunications Union formulate, H.263, H.26L, H.264 the MEPG-1 that MPEG formulates knits in the Motion Picture Experts Group of standard and the ISO of International Standards Organization, MPEG-2, MPEG-4 etc. are based on the hybrid coding Hybrid Coding framework.So-called hybrid encoding frame is to take all factors into consideration prediction, and the coding framework of the method for conversion and entropy coding has following main feature: 1, utilize prediction to remove the redundancy of time-domain; 2, utilize conversion to remove the redundancy of spatial domain; 3, utilize entropy coding to remove statistical redundancy.
Above-mentioned video encoding standard all has intracoded frame, i.e. I frame, and inter-frame encoding frame, i.e. and P frame, I frame and P frame adopt different coding methods.The cataloged procedure of I frame is as follows: the residual block that raw image data or infra-frame prediction are obtained carries out two-dimensional transform; In transform domain, conversion coefficient is quantized then; The two-dimensional transform coefficient block that quantizes gained is scanned, make it to become the conversion coefficient sequence of one dimension; Carry out entropy coding at last, i.e. Huffman coding or arithmetic coding etc.The cataloged procedure of P frame is as follows: adopt estimation to obtain motion vector, adopt inter prediction then based on motion compensation, then the residual block that inter prediction is obtained carries out two-dimensional transform, again coefficient in transform domain is quantized, the two-dimentional residual block coefficient that quantizes gained is scanned, make it to become the residual error coefficient sequence of one dimension, carry out entropy coding at last.
In the process of scanning two-dimensional transform coefficient block, require to scan the bigger coefficient of absolute value earlier as far as possible, make the one dimension coefficient sequence of output more trend towards arranging from big to small, help to improve code efficiency like this.In the coefficient block, the coefficient regularity of distribution roughly is near low frequency, and just there is more nonzero coefficient in the upper left corner of transformation coefficient block, and absolute value is bigger, and is corresponding, near high frequency, promptly near near the lower right corner of transformation coefficient block, more zero coefficient arranged.Scanning sequency zig-zag begins to high frequency sweep from low frequency, and gained one dimension coefficient is arranged from big to small.So zig-zag is widely used in various images and the video encoding and decoding standard.But zig-zag puts on an equal footing the distribution of coefficient in level and vertical direction, and this just can not meet the regularity of distribution of the coefficient block that the interlaced video sequence coding is produced well.In order to adapt to the various distribution characters of conversion coefficient, MPEG-2, H.264 MPEG-4 waits video compression standard to adopt several different scanning sequencies, according to coding mode switched scan order, makes code efficiency that certain raising arranged.However, two or three scanning sequencies still do not have universality, have the transformation coefficient block of special distribution rule for some, and the one dimension coefficient sequence of output is arranged from big to small, have reduced code efficiency.
Summary of the invention
The purpose of this invention is to provide a kind of method and apparatus that applies to the scan conversion coefficient of video or image compression.The present invention allows the transformation coefficient block with special distribution rule is adopted the scanning sequency of special its characteristic distributions of adaptation.
In order to achieve the above object, the technical solution used in the present invention is as follows:
A kind of method that applies to the scan conversion coefficient of video or image compression, the process of scan conversion coefficient comprises:
1) preestablishes scanning sequency to conversion coefficient;
2) encoder determines whether adopt predefined scanning sequency and produce control signal according to optimisation strategy;
3) if adopt predefined scanning sequency, then this predefined scanning sequency is adopted in the control signal indication;
4) if do not adopt predefined scanning sequency, then generate actual scanning sequency, control signal is used to indicate the scanning sequency that adopts this actual generation, and the actual scanning sequency that generates becomes the part of the compressed signal of generation;
5) according to the scanning sequency scan conversion coefficient block of control signal indication, make it to become the conversion coefficient sequence;
6) the conversion coefficient sequence of control signal and scanning gained becomes the part of the compressed signal of generation.
Further, also comprise with the actual scanning sequency that generates as predefined scanning sequency.
The method of the scan conversion coefficient of a kind of video that applies to compress or image decompressor, the video of this compression or picture signal have following feature,
1) scanning sequency of conversion coefficient preestablishes or generates and be contained in the compressed signal by encoder is actual,
2) contain control signal in the compressed signal, be used for indicating the scanning sequency of conversion coefficient whether to be contained in compressed signal;
The process of scan conversion coefficient comprises:
1) preestablishes scanning sequency to conversion coefficient;
2), judge whether to use predefined scanning sequency according to the control signal in the compressed signal;
3) if predefined scanning sequency is used in the control signal indication, then use predefined scanning sequency, the conversion coefficient sequence is made counter-scanning, make it to become transformation coefficient block;
4) if predefined scanning sequency is not used in the control signal indication, then use the scanning sequency in the compressed signal that the conversion coefficient sequence is made counter-scanning, make it to become transformation coefficient block.
Further, also comprise with the scanning sequency in the video compression signal as predefined scanning sequency.A kind of code device of using the method for above-mentioned scan conversion coefficient, it comprises:
One first storage device is deposited predefined scanning sequency;
One second storage device when the actual scanning order is different from predefined scanning sequency, is deposited the actual scanning order;
The one scan device is used for the scan conversion coefficient block;
One first TDMD time division multiplex device;
According to control signal, scanning means links to each other with first storage device and scanning means links to each other with first TDMD time division multiplex device; Or scanning means links to each other with second storage device, and scanning means links to each other with first TDMD time division multiplex device, and second storage device links to each other with first TDMD time division multiplex device.
A kind of decoding device of using the method for above-mentioned scan conversion coefficient, it comprises:
One the 3rd storage device is deposited predefined scanning sequency;
One the 4th storage device when the control signal indication is not used predefined scanning sequency, is deposited the actual scanning order;
One counter-scanning device is used for counter-scanning conversion coefficient sequence;
One second TDMD time division multiplex device;
According to control signal, the counter-scanning device links to each other with the 3rd storage device and the counter-scanning device links to each other with second TDMD time division multiplex device; Or the counter-scanning device links to each other with the 4th storage device, and the counter-scanning device links to each other with second TDMD time division multiplex device, and the 4th storage device links to each other with second TDMD time division multiplex device.
The present invention compares with background technology, the beneficial effect that has: it allows the transformation coefficient block with special distribution rule is adopted the scanning sequency of special its characteristic distributions of adaptation.The flexibility that this has increased scanning sequency has overcome the shortcoming that adopts several scanning constant orders, meets the regularity of distribution of coefficient in transform domain piece coefficient more, makes the conversion coefficient sequence of scanning gained more trend towards arriving minispread greatly, helps the raising of code efficiency.The present invention is not limited to video coding or image code domain, can also extend in the application of other signal processing.
Description of drawings
Fig. 1 is the code device block diagram that has method at present now;
Fig. 2 is the decoding device block diagram that has method at present now;
Fig. 3 is the code device block diagram of the embodiment of the invention 1;
Fig. 4 is the decoding device block diagram of the embodiment of the invention 1;
Fig. 5 is the code device block diagram of the embodiment of the invention 2;
Fig. 6 is the decoding device block diagram of the embodiment of the invention 2.
Embodiment
Accompanying drawing 1 shows the code device of existing scan conversion coefficient, comprises first storage device, second storage device, select scanning sequency switch 1, be used to scan the scanning means of two-dimensional transform coefficient block.
Predefined two kinds of different scanning sequencies are deposited in first storage device, second storage device respectively; Conversion coefficient is by data/address bus input scan device; Coding mode control switch 1 makes scanning means link to each other with first storage device or links to each other with second storage device; Scanning means reads in scanning sequency from coupled storage device, the scan conversion coefficient block makes it become the output of conversion coefficient sequence.
Accompanying drawing 2 shows the decoding device of existing scan conversion coefficient, comprises the 3rd storage device, the 4th storage device, select scanning sequency switch 2, be used for the counter-scanning device of counter-scanning two-dimensional transform coefficient block.
Predefined two kinds of different scanning sequencies are deposited in the 3rd storage device, the 4th storage device respectively; Conversion coefficient is by data/address bus input counter-scanning device; Decoding schema control switch 2 makes the counter-scanning device link to each other with the 3rd storage device or links to each other with the 4th storage device; The counter-scanning device reads in scanning sequency from coupled storage device, counter-scanning conversion coefficient sequence makes it become transformation coefficient block output.
The weak point of existing method is that scan method preestablishes, underaction.For the transformation coefficient block with special distribution, code efficiency is not high.Below at the deficiency of existing method, and present invention will be described in detail with reference to the accompanying.
Embodiment 1
Accompanying drawing 3 shows a kind of code device that applies to the scan conversion coefficient of video or image compression, comprise first storage device that is used to deposit predefined scanning sequency, be used to deposit the actual scanning order second storage device, select the switch 1 of storage device, the switch 2 that whether will export according to control signal decision actual scanning order, be used to scan the scanning means of two-dimensional transform coefficient block and be used for first TDMD time division multiplex device of timesharing output according to control signal.
Predefined scanning sequency is imported first storage device; Conversion coefficient is by data/address bus input scan device; Code device judges whether to adopt predefined scanning sequency according to code efficiency, and produces control signal; If adopt predefined scanning sequency, control signal control switch 1 makes scanning means link to each other with storage device 1; If do not adopt predefined scanning sequency, then generate actual scanning sequency, and import second storage device according to code efficiency, control signal control switch 1 makes scanning means link to each other with second storage device; Scanning means reads in scanning sequency from connected storage device; Scanning means links to each other with data/address bus, and the one-dimensional transform coefficient sequence after the scanning is outputed to first TDMD time division multiplex device; When second storage device linked to each other with scanning means, control signal control switch 2 made that the scanning sequency in second storage device outputs to first TDMD time division multiplex device; Control signal is outputed to first TDMD time division multiplex device; Scanning sequency in second storage device by one-dimensional transform coefficient sequence, control signal behind the first TDMD time division multiplex device timesharing output scanning and when not adopting predefined scanning sequency.The data of first TDMD time division multiplex device output become the part of compressed signal.
Accompanying drawing 4 shows a kind of decoding device that applies to the scan conversion coefficient of video or image compression, comprising: be used to deposit predefined scanning sequency the 3rd storage device, be used to deposit the actual scanning order the 4th storage device, select the switch 3 of storage device, the switch 4 that whether will import according to control signal decision actual scanning order, be used for the counter-scanning device of counter-scanning one-dimensional transform coefficient sequence and be used for second TDMD time division multiplex device of timesharing input according to control signal.
Compressed signal is imported second TDMD time division multiplex device, reads in control signal from second TDMD time division multiplex device; If predefined scanning sequency is used in the control signal indication, control signal control switch 3 makes the counter-scanning device link to each other with the 3rd storage device; If predefined scanning sequency is not used in the control signal indication, then the control signal control switch 4, make actual scanning sequency read and import the 4th storage device by data/address bus from second TDMD time division multiplex device, control signal control switch 3 makes the counter-scanning device link to each other with the 4th storage device; Read in the one-dimensional transform coefficient from second TDMD time division multiplex device, the one-dimensional transform coefficient is by data/address bus input counter-scanning device; The counter-scanning device reads in scanning sequency from connected storage device; The counter-scanning device links to each other with data/address bus, the two-dimensional transform coefficient block behind the output counter-scanning.
Embodiment 2
Accompanying drawing 5 shows a kind of code device that applies to the scan conversion coefficient of video or image compression, comprise first storage device that is used to deposit predefined scanning sequency, be used to deposit the actual scanning order second storage device, according to control signal select the switch 1 of storage device, the switch 2 that whether will export according to control signal decision actual scanning order, according to control signal decision whether connect first storage device and second storage device switch 5, be used to scan the scanning means of two-dimensional transform coefficient block and be used for first TDMD time division multiplex device of timesharing output.
Predefined scanning sequency is imported first storage device; Conversion coefficient is by data/address bus input scan device; Judge whether to use predefined scanning sequency according to code efficiency, and produce control signal; If adopt predefined scanning sequency, control signal control switch 1 makes scanning means link to each other with first storage device; If do not adopt predefined scanning sequency, then generate actual scanning sequency, and import second storage device according to code efficiency, control signal control switch 1 makes scanning means link to each other with second storage device; Scanning means reads in scanning sequency from connected storage device; Scanning means links to each other with data/address bus, and the one-dimensional transform coefficient sequence after the scanning is outputed to first TDMD time division multiplex device; When second storage device linked to each other with scanning means, control signal control switch 2 made that the scanning sequency in second storage device outputs to first TDMD time division multiplex device; Control signal is outputed to first TDMD time division multiplex device; Scanning sequency in second storage device by one-dimensional transform coefficient sequence, control signal behind the first TDMD time division multiplex device timesharing output scanning and when not adopting predefined scanning sequency; If do not adopt predefined scanning sequency, control signal control switch 5 makes first storage device link to each other with second storage device, and the scanning sequency in second storage device is imported first storage device as predefined scanning sequency.The data of first TDMD time division multiplex device output become the part of compressed signal.
Accompanying drawing 6 shows a kind of decoding device that applies to the scan conversion coefficient of video or image compression, comprising: the 3rd storage device that is used to deposit predefined scanning sequency, be used to deposit the 4th storage device of actual scanning order, select the switch 3 of storage device according to control signal, determine the switch 4 whether the actual scanning order will be imported according to control signal, whether decision connects the switch 6 of the 3rd storage device and the 4th storage device according to control signal, be used for the counter-scanning device of counter-scanning one-dimensional transform coefficient sequence and be used for second TDMD time division multiplex device that timesharing is imported.
Compressed signal is imported second TDMD time division multiplex device, reads in control signal from second TDMD time division multiplex device; If predefined scanning sequency is used in the control signal indication, control signal control switch 3 makes the counter-scanning device link to each other with the 3rd storage device; If predefined scanning sequency is not used in the control signal indication, then the control signal control switch 4, make actual scanning sequency read and import the 4th storage device by data/address bus from second TDMD time division multiplex device, control signal control switch 3 makes the counter-scanning device link to each other with the 4th storage device; Read in the one-dimensional transform coefficient from second TDMD time division multiplex device, the one-dimensional transform coefficient is by data/address bus input counter-scanning device; The counter-scanning device reads in scanning sequency from connected storage device; The counter-scanning device links to each other with data/address bus, the two-dimensional transform coefficient block behind the output counter-scanning; If do not adopt predefined scanning sequency, control signal control switch 6 makes the 3rd storage device link to each other with the 4th storage device, and the scanning sequency in the 4th storage device is imported the 3rd storage device as predefined scanning sequency.
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.