The method and apparatus of adaptive scanning in video or the image compression
Technical field
The present invention relates to a kind of electric numerical data treatment technology, particularly relate to a kind of method and apparatus that applies to adaptive scanning in video or the 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 existing international standard, the mode of the scan conversion coefficient of employing has two kinds of frame scan and field scans, is respectively applied for frame by frame pattern-coding and encodes by field mode.To pattern-coding frame by frame with adopt different scan methods respectively by the field mode coding, be that the distribution statistics according to conversion coefficient obtains.But in international standard, no matter be classical MPEG2, or up-to-date H264/AVC, all just adopting frame by frame, pattern-coding adopts frame scan, press the field mode coding and adopt field scan, the scan table that its frame scan and field scan are adopted all is a predetermined fixed, can not adjust adaptively according to the feature of vision signal, has therefore limited compression performance ground and has further promoted.
Summary of the invention
The method and apparatus that the purpose of this invention is to provide adaptive scanning in a kind of video coding can be to the scanning sequency of special its characteristic distributions of adaptation of the transformation coefficient block employing of pressing the different mode coding in the same image.
In order to achieve the above object, the technical solution used in the present invention is as follows:
1, its step of method of adaptive scanning is as follows in a kind of video or the image compression:
1) scan table of the conversion coefficient of dissimilar pieces preestablishes or is contained in the video code flow;
2) during encoder encodes according to dissimilar pieces, select for use corresponding scan table to scan.
Described encoder upgrades the scan table of dissimilar pieces respectively, passes the scan table of update mode signal and renewal in code stream; Or do not upgrade scan table, in code stream, only pass the update mode signal.
Described dissimilar piece is meant a frame encoding block and an encoding block.
2, its step of method of adaptive scanning is as follows in another kind of video or the image compression:
1) scan table of the conversion coefficient of dissimilar pieces preestablishes or is contained in the video code flow;
2) during decoder decode according to the dissimilar piece that has solved, select for use corresponding scan table to scan.
Described decoder upgrades the scan table of dissimilar pieces respectively according to the update mode signal that passes in the code stream.
Described dissimilar piece is meant a frame encoding block and an encoding block.
3, the device of adaptive scanning in a kind of video or the image compression, it comprises the initialization storage device that is used for the store initialization scan table, be used to deposit two to n storage devices of scan table, the scanning means that is used for the conversion coefficient signal of scanning block, be used to select scan the selector of the scan table of current block, be used to select the selector and the TDMD time division multiplex device of the storage device that needs upgrade; An end that is used to select scan table to scan the selector of current block links to each other with first storage device, second storage device and n storage device respectively, be used to select the other end of selector of scan table scanning current block and the scanning means of the conversion coefficient signal that is used for scanning block to link to each other, dissimilar block signals links to each other with TDMD time division multiplex device with the selector that is used to select scan table to scan current block respectively, the conversion coefficient signal of one termination block of scanning means, another termination TDMD time division multiplex device of scanning means; Be subjected to the control of update mode signal and initialize signal newly-generated scan table signal and the initialization storage device of selector one termination that is used to select the storage device that upgrades, be used to select the other end of the selector of the storage device that upgrades to link to each other with first storage device, second storage device and n storage device respectively, be subjected to the newly-generated scan table signal of a termination of the switch of update mode signal controlling, another termination TDMD time division multiplex device of switch.
4, the device of adaptive scanning in another kind of video or the image compression, it comprises the initialization storage device that is used for the store initialization scan table, be used to deposit two to n storage devices of scan table, the counter-scanning device that is used for the conversion coefficient signal of counter-scanning piece, be used to select scan the selector of the scan table of current block, be used to select the selector and the TDMD time division multiplex device of the storage device that needs upgrade; Be used to select scan table scanning current block selector an end respectively with first storage device, second storage device links to each other with n storage device, the other end that is used to select scan table to scan the selector of current block links to each other with the counter-scanning device of the other end with the conversion coefficient signal that is used for the counter-scanning piece, be subjected to the control of update mode signal and initialize signal be used for select selector one end of the storage device that upgrades to link to each other with the initialization storage device with the scan table signal of code stream, the other end that is used to select the other end of selector of the storage device that upgrades and the selector of the storage device that is used to select upgrade respectively with first storage device, second storage device links to each other with n storage device.The conversion coefficient signal of counter-scanning device one termination block that is used for the conversion coefficient signal of counter-scanning piece is used for another termination output of counter-scanning device of the conversion coefficient signal of counter-scanning piece.
The present invention compares the beneficial effect that has with background technology: it allows dissimilar pieces is adopted different scan tables, and scan table can change along with the time.When the video properties of dissimilar pieces changes respectively, can generate new scan table respectively, employed newly-generated scan table will be transferred to decoding end from coding side as the part of video code flow.Decoding end is then according to the update mode information analysis in the code stream and upgrade corresponding scan table.This method has increased the flexibility of scanning sequency, thereby improves 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 of the embodiment of the invention 3;
Fig. 2 is the decoding device block diagram of the embodiment of the invention 4.
Embodiment
Embodiment 1
In the H264/AVC standard, when using the frame field adaptive coding, current images is divided into the macro block of framing code to right with the macro block of encoding by the field, conversion coefficient to the macro block of the macro block centering of framing code adopts frame scan, to adopting field scan by a conversion coefficient of the macro block of the macro block centering of coding.
Add up respectively framing code macro block centering macro block conversion coefficient and by the distribution character of the conversion coefficient of the macro block of the macro block centering of field coding, generate the characteristic that new scan table comes the adaptive video signal respectively.
According to the characteristic of vision signal, judge whether to upgrade the scan table of frame scan and the scan table of field scan respectively.The update mode signal of the scan table of the scan table of transmission frame scanning and field scan in code stream, and according to the update mode signal, the scan table of the scan table of the scan table of the scan table of the newly-generated frame scan of transmission, newly-generated field scan, newly-generated frame scan and newly-generated field scan or do not transmit scan table in code stream.
According to the update mode signal in the code stream, the scan table that adopts the scan table of the frame scan of upgrading respectively and field scan to the macro block of framing code to scanning respectively with conversion coefficient by the macro block of the macro block centering of field coding.
Embodiment 2
In digital audio/video encoding and decoding technique standard (AVS), when using the frame field adaptive coding, current images is divided into the macro block of framing code to right with the macro block of encoding by the field, conversion coefficient to the macro block of the macro block centering of framing code adopts frame scan, to adopting field scan by a conversion coefficient of the macro block of the macro block centering of coding.
Add up respectively framing code macro block centering macro block conversion coefficient and by the distribution character of the conversion coefficient of the macro block of the macro block centering of field coding, generate the characteristic that new scan table comes the adaptive video signal respectively.
According to the characteristic of vision signal, judge whether to upgrade the scan table of frame scan and the scan table of field scan respectively.The update mode signal of the scan table of the scan table of transmission frame scanning and field scan in code stream, and according to the update mode signal, the scan table of the scan table of the scan table of the scan table of the newly-generated frame scan of transmission, newly-generated field scan, newly-generated frame scan and newly-generated field scan or do not transmit scan table in code stream.
In digital audio/video encoding and decoding technique standard (AVS), when using the frame field adaptive coding, current images is divided into the macro block of framing code to right with the macro block of encoding by the field, the macro block centering by the field coding wherein is divided into a top macro block and field, end macro block, its video properties can be different, can adopt the scan table of same field scan, perhaps top macro block and field, end macro block use the scan table of the field scan of the scan table of field scan on top and field, the end respectively.Therefore n can adjust according to coded system.
According to the update mode signal in the code stream, the scan table that adopts the scan table of the frame scan of upgrading respectively and field scan to the macro block of framing code to scanning respectively with conversion coefficient by the macro block of the macro block centering of field coding.
Embodiment 3
Fig. 1 shows the code device of the device of adaptive scanning in a kind of video or the image compression, comprising:
The initialization storage device 2 that is used for the store initialization scan table, be used to deposit two storage devices 1 of scan table, the scanning means 7 that is used for the conversion coefficient signal of scanning block, be used to select scan the selector 6 of the scan table of current block, be used to select the selector 4 and the TDMD time division multiplex device 5 of the storage device that needs upgrade.
The control of initialize signal following earlier initialization storage device 2 in the scan table of predefined frame scan and the scan table of field scan deposit two storage devices 1 respectively in; The conversion coefficient signal of piece is by data/address bus input scan device 7; Code device judges whether to upgrade scan table according to code efficiency, and produces the update mode signal; If do not upgrade scan table, send the update mode signal indicating and do not do any change; If renewal scan table, then generate new scan table according to code efficiency, and according to the corresponding storage device of update mode signal controlling selector 4 inputs, upgrade the scan table of frame scan, the scan table of field scan respectively, update mode Signal-controlled switch 3 outputs to TDMD time division multiplex device 5 with newly-generated scan table signal; Is the piece of framing code or is the scan table of frame scan or the scan table of field scan by the dissimilar block signal of input, export conversion coefficient sequence behind the conversion coefficient signal scanning of current block, update mode signal by TDMD time division multiplex device 5 timesharing and whether export newly-generated scan table signal according to the update mode signal deciding by the scan table that the piece of field coding decides the conversion coefficient signal of current block to use in scanning means 7 by selector 6.The signal of TDMD time division multiplex device 5 outputs is as the part of code stream.
Embodiment 4
Fig. 2 shows the decoding device of the device of adaptive scanning in a kind of video or the image compression, comprising:
The initialization storage device 10 that is used for the store initialization scan table, be used to deposit two 11 of scan table, the counter-scanning device 13 that is used for the conversion coefficient signal of counter-scanning piece, be used to select scan the selector 12 of the scan table of current block, be used to select the selector 9 and the TDMD time division multiplex device 8 of the storage device that needs upgrade;
Earlier the scan table of the scan table of predefined frame scan in the initialization storage device 10 and field scan is deposited in two storage devices 11 respectively under the control of initialize signal, code stream input TDMD time division multiplex device 8 reads in the update mode signal from TDMD time division multiplex device 8; If scan table is upgraded in the indication of update mode signal, then update mode signal controlling selector 10 the new scan table of reading from TDMD time division multiplex device 8, is imported the scan table of corresponding storage frame scanning or the scan table storage device of field scan; If the indication of update mode signal is not upgraded scan table then is skipped above-mentioned steps.According to reading in the piece that dissimilar block signals is a framing code from TDMD time division multiplex device 8 or controlling selector 12 by the piece of field coding and determine that the scan table of the conversion coefficient signal employing of current block is the scan table of frame scan or the scan table of field scan; Read in the conversion coefficient signal of current block from TDMD time division multiplex device 8, the conversion coefficient signal of current block is by data/address bus input counter-scanning device 13; Counter-scanning device 13 reads in scan table from connected selector 12; Counter-scanning device 13 links to each other with data/address bus, the two-dimensional transform coefficient block after output scans through 2.
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.