This invention relates to video data encoding and decoding.
The “background” description provided herein is for the purpose of generally presenting the context of the disclosure. Work of the presently named inventors, to the extent it is described in this background section, as well as aspects of the description which may not otherwise qualify as prior art at the time of filing, are neither expressly or impliedly admitted as prior art against the present invention.
There are several video data compression and decompression systems (as examples of encoding and decoding systems) which involve transforming video data into a frequency domain representation, quantising the frequency domain coefficients and then applying some form of entropy encoding to the quantised coefficients.
Entropy, in the present context, can be considered as representing the information content of a data symbol or series of symbols. The aim of entropy encoding is to encode a series of data symbols in a lossless manner using (ideally) the smallest number of encoded data bits which are necessary to represent the information content of that series of data symbols. In practice, entropy encoding is used to encode the quantised coefficients such that the encoded data is smaller (in terms of its number of bits) than the data size of the original quantised coefficients. A more efficient entropy encoding process gives a smaller output data size for the same input data size.
An important part of the entropy encoding process used in video data compression relates to the order in which the quantised coefficients are presented for encoding.
Typically, a data scanning or reordering process is applied to the quantised coefficients. The purpose of the scanning process is to reorder the quantised frequency-transformed data so as to gather as many as possible of the non-zero quantised transformed coefficients together, and of course therefore to gather as many as possible of the zero-valued coefficients together. These features can allow so-called run-length coding or similar techniques (which encode runs or successive sequences of zeros by a small number of data bits defining the length of the run) to be applied efficiently. So, the scanning process involves selecting coefficients from the quantised transformed data, and in particular from a block of coefficients corresponding to a block of image data which has been transformed and quantised, according to a “scanning order” so that (a) all of the coefficients are selected once as part of the scan, and (b) the scan tends to provide the desired reordering.
In practical terms, the output of the frequency domain transformation stage typically comprises a set of frequency domain coefficients which vary according to the horizontal and vertical spatial frequencies which they represent in the original image block. There is generally a so-called “DC” coefficient which represents the average (DC) value of the samples in the original image block, together with a succession of coefficients representing respective permutations of low or high horizontal and vertical spatial frequency ranges.
The way in which these coefficients are ordered for transmission to the data scanning process is of course arbitrary, but for convenience the coefficients are often considered to form a data array with the DC coefficient in a top-left corner of the array, increasing horizontal spatial frequency represented in a left-to-right direction in the array and increasing vertical spatial frequency represented in a top-to-bottom direction in the array. Under this representation, a data scanning process which has been found to provide useful results is a so-called zigzag scan, which starts with the DC coefficient and then proceeds through the remaining coefficients, one by one, in a zigzag fashion. An example of a zigzag scan is illustrated schematically in
The zigzag scan is considered advantageous because, for many normal types of image, and in particular images which have been captured from real scenes, most of the information content tends to lie in the DC and low frequency coefficients. It is often the case that many or all of the higher frequency coefficients are zero. This is particularly the case in systems such as the proposed “High Efficiency Video Coding” (HEVC) system in which residual image data (that is to say, data representing the difference between an actual image and a predicted version of that image) is encoded. So, by scanning the DC and lower frequency coefficients first, the non-zero values can tend to be gathered together and the zero values can also tend to be gathered together. As mentioned above, this can lead to a more efficient entropy encoding process.
This invention provides video data encoding apparatus in which arrays of video data are reordered for entropy encoding, the apparatus comprising:
a frequency domain converter for generating a frequency domain representation of data derived from an input video signal, the frequency domain representation comprising an array of plural frequency domain coefficients in respect of each image area;
a selector for selecting a reordering pattern from a set of two or more candidate reordering patterns, for use in reordering the array of frequency domain coefficients;
a data scanner for changing the order of the frequency domain coefficients according to the selected reordering pattern so as to generate reordered coefficients; and
an entropy encoder for entropy-encoding the reordered coefficients;
in which the candidate reordering patterns include at least one reordering pattern selected from the list consisting of:
a first reordering pattern arranged to reorder the frequency domain data so that the reordered data comprises successive subsets of the frequency domain data, each subset comprising data representative of a constant spatial frequency in one dimension, the one dimension being different from subset to subset;
a second reordering pattern arranged to reorder the frequency domain data so that data indicative of one or more sets of a constant horizontal spatial frequency or a constant vertical spatial frequency respectively are arranged to precede remaining data of the frequency domain data, the remaining frequency domain data being ordered according to successive subsets, each subset being selected so that the sum of a horizontal spatial frequency component and a vertical spatial frequency component is generally constant for coefficients within a subset; and
a third reordering pattern arranged to reorder the frequency domain data according to successive subsets alternating between a constant and increasing horizontal spatial frequency and a constant and increasing vertical spatial frequency.
The invention recognises that depending on properties of the image data to be compressed or other aspects of the compression process, an improved efficiency (which is to say, a lower number of output data bits) may be obtained by varying the scanning (reordering) pattern used to scan the data for entropy encoding.
Further respective aspects and features of the invention are defined in the appended claims.
It is to be understood that both the foregoing general description of the invention and the following detailed description are exemplary, but not restrictive of, the invention.
A more complete appreciation of the disclosure and many of the attendant advantages thereof will be readily obtained as the same becomes better understood by reference to the following detailed description of embodiments of the invention, when considered in connection with the accompanying drawings, wherein:
Referring now to the drawings,
All of the data compression and/or decompression apparatus is to be described below may be implemented in hardware, in software running on a general-purpose data processing apparatus such as a general-purpose computer, as programmable hardware such as an application specific integrated circuit (ASIC) or field programmable gate array (FPGA) or as combinations of these. In cases where the embodiments are implemented by software and/or firmware, it will be appreciated that such software and/or firmware, and non-transitory machine-readable data storage media by which such software and/or firmware are stored or otherwise provided, are considered as embodiments of the present invention.
An input audio/video signal 10 is supplied to a video data compression apparatus 20 which compresses at least the video component of the audio/video signal 10 for transmission along a transmission route 30 such as a cable, an optical fibre, a wireless link or the like. The compressed signal is processed by a decompression apparatus 40 to provide an output audio/video signal 50. For the return path, a compression apparatus 60 compresses an audio/video signal for transmission along the transmission route 30 to a decompression apparatus 70.
The compression apparatus 20 and decompression apparatus 70 can therefore form one node of a transmission link. The decompression apparatus 40 and decompression apparatus 60 can form another node of the transmission link. Of course, in instances where the transmission link is uni-directional, only one of the nodes would require a compression apparatus and the other node would only require a decompression apparatus.
It will be appreciated that the compressed or encoded signal, and a storage medium storing that signal, are considered as embodiments of the present invention.
The techniques to be described below relate primarily to video data compression. It will be appreciated that many existing techniques may be used for audio data compression in conjunction with the video data compression techniques which will be described, to generate a compressed audio/video signal. Accordingly, a separate discussion of audio data compression will not be provided. It will also be appreciated that the data rate associated with video data, in particular broadcast quality video data, is generally very much higher than the data rate associated with audio data (whether compressed or uncompressed). It will therefore be appreciated that uncompressed audio data could accompany compressed video data to form a compressed audio/video signal. It will further be appreciated that although the present examples (shown in
Successive images of an input video signal 300 are supplied to an adder 310 and to an image predictor 320. The image predictor 320 will be described below in more detail with reference to
One reason why a residual image signal is generated is as follows. The data coding techniques to be described, that is to say the techniques which will be applied to the residual image signal, tends to work more efficiently when there is less “energy” in the image to be encoded. Here, the term “efficiently” refers to the generation of a small amount of encoded data; for a particular image quality level, it is desirable (and considered “efficient”) to generate as little data as is practicably possible. The reference to “energy” in the residual image relates to the amount of information contained in the residual image. If the predicted image were to be identical to the real image, the difference between the two (that is to say, the residual image) would contain zero information (zero energy) and would be very easy to encode into a small amount of encoded data. In general, if the prediction process can be made to work reasonably well, the expectation is that the residual image data will contain less information (less energy) than the input image and so will be easier to encode into a small amount of encoded data.
The residual image data 330 is supplied to a transform unit 340 which generates a discrete cosine transform (DCT) representation of the residual image data. The DCT technique itself is well known and will not be described in detail here. There are however aspects of the techniques used in the present apparatus which will be described in more detail below, in particular relating to the selection of different blocks of data to which the DCT operation is applied. These will be discussed with reference to
The output of the transform unit 340, which is to say, a set of DCT coefficients for each transformed block of image data, is supplied to a quantiser 350. Various quantisation techniques are known in the field of video data compression, ranging from a simple multiplication by a quantisation scaling factor through to the application of complicated lookup tables under the control of a quantisation parameter. The general aim is twofold. Firstly, the quantisation process reduces the number of possible values of the transformed data. Secondly, the quantisation process can increase the likelihood that values of the transformed data are zero. Both of these can make the entropy encoding process, to be described below, work more efficiently in generating small amounts of compressed video data.
A data scanning process is applied by a scan unit 360. The purpose of the scanning process is to reorder the quantised transformed data so as to gather as many as possible of the non-zero quantised transformed coefficients together, and of course therefore to gather as many as possible of the zero-valued coefficients together. These features can allow so-called run-length coding or similar techniques to be applied efficiently. So, the scanning process involves selecting coefficients from the quantised transformed data, and in particular from a block of coefficients corresponding to a block of image data which has been transformed and quantised, according to a “scanning order” so that (a) all of the coefficients are selected once as part of the scan, and (b) the scan tends to provide the desired reordering. Techniques for selecting a scanning order will be described below. One example scanning order which can tend to give useful results is a so-called zigzag scanning order.
The scanned coefficients are then passed to an entropy encoder (EE) 370. Again, various types of entropy encoding may be used. Two examples which will be described below are variants of the so-called CABAC (Context Adaptive Binary Arithmetic Coding) system and variants of the so-called CAVLC (Context Adaptive Variable-Length Coding) system. In general terms, CABAC is considered to provide a better efficiency, and in some studies has been shown to provide a 10-20% reduction in the quantity of encoded output data for a comparable image quality compared to CAVLC. However, CAVLC is considered to represent a much lower level of complexity (in terms of its implementation) than CABAC. The CABAC technique will be discussed with reference to
Note that the scanning process and the entropy encoding process are shown as separate processes, but in fact can be combined or treated together. That is to say, the reading of data into the entropy encoder can take place in the scan order. Corresponding considerations apply to the respective inverse processes to be described below.
The output of the entropy encoder 370, along with additional data (mentioned above and/or discussed below), for example defining the manner in which the predictor 320 generated the predicted image, provides a compressed output video signal 380.
However, a return path is also provided because the operation of the predictor 320 itself depends upon a decompressed version of the compressed output data.
The reason for this feature is as follows. At the appropriate stage in the decompression process (to be described below) a decompressed version of the residual data is generated. This decompressed residual data has to be added to a predicted image to generate an output image (because the original residual data was the difference between the input image and a predicted image). In order that this process is comparable, as between the compression side and the decompression side, the predicted images generated by the predictor 320 should be the same during the compression process and during the decompression process. Of course, at decompression, the apparatus does not have access to the original input images, but only to the decompressed images. Therefore, at compression, the predictor 320 bases its prediction (at least, for inter-image encoding) on decompressed versions of the compressed images.
The entropy encoding process carried out by the entropy encoder 370 is considered to be “lossless”, which is to say that it can be reversed to arrive at exactly the same data which was first supplied to the entropy encoder 370. So, the return path can be implemented before the entropy encoding stage. Indeed, the scanning process carried out by the scan unit 360 is also considered lossless, but in the present embodiment the return path 390 is from the output of the quantiser 350 to the input of a complimentary inverse quantiser 420.
In general terms, an entropy decoder 410, the reverse scan unit 400, an inverse quantiser 420 and an inverse transform unit 430 provide the respective inverse functions of the entropy encoder 370, the scan unit 360, the quantiser 350 and the transform unit 340. For now, the discussion will continue through the compression process; the process to decompress an input compressed video signal will be discussed separately below.
In the compression process, the scanned coefficients are passed by the return path 390 from the quantiser 350 to the inverse quantiser 420 which carries out the inverse operation of the scan unit 360. An inverse quantisation and inverse transformation process are carried out by the units 420, 430 to generate a compressed-decompressed residual image signal 440.
The image signal 440 is added, at an adder 450, to the output of the predictor 320 to generate a reconstructed output image 460. This forms one input to the image predictor 320, as will be described below.
Turning now to the process applied to a received compressed video signal 470, the signal is supplied to the entropy decoder 410 and from there to the chain of the reverse scan unit 400, the inverse quantiser 420 and the inverse transform unit 430 before being added to the output of the image predictor 320 by the adder 450. In straightforward terms, the output 460 of the adder 450 forms the output decompressed video signal 480. In practice, further filtering may be applied before the signal is output.
There are two basic modes of prediction: so-called intra-image prediction and so-called inter-image, or motion-compensated (MC), prediction.
Intra-image prediction bases a prediction of the content of a block of the image on data from within the same image. This corresponds to so-called I-frame encoding in other video compression techniques. In contrast to I-frame encoding, where the whole image is intra-encoded, in the present embodiments the choice between intra- and inter- encoding can be made on a block-by-block basis, though in other embodiments of the invention the choice is still made on an image-by-image basis.
Motion-compensated prediction makes use of motion information which attempts to define the source, in another adjacent or nearby image, of image detail to be encoded in the current image. Accordingly, in an ideal example, the contents of a block of image data in the predicted image can be encoded very simply as a reference (a motion vector) pointing to a corresponding block at the same or a slightly different position in an adjacent image.
Returning to
The actual prediction, in the intra-encoding system, is made on the basis of image blocks received as part of the signal 460, which is to say, the prediction is based upon encoded-decoded image blocks in order that exactly the same prediction can be made at a decompression apparatus. However, data can be derived from the input video signal 300 by an intra-mode selector 520 to control the operation of the intra-image predictor 530.
For inter-image prediction, a motion compensated (MC) predictor 540 uses motion information such as motion vectors derived by a motion estimator 550 from the input video signal 300. Those motion vectors are applied to a processed version of the reconstructed image 460 by the motion compensated predictor 540 to generate blocks of the inter-image prediction.
The processing applied to the signal 460 will now be described. Firstly, the signal is filtered by a filter unit 560. This involves applying a “deblocking” filter to remove or at least tend to reduce the effects of the block-based processing carried out by the transform unit 340 and subsequent operations. Also, an adaptive loop filter is applied using coefficients derived by processing the reconstructed signal 460 and the input video signal 300. The adaptive loop filter is a type of filter which, using known techniques, applies adaptive filter coefficients to the data to be filtered. That is to say, the filter coefficients can vary in dependence upon various factors. Data defining which filter coefficients to use is included as part of the encoded output datastream.
The filtered output from the filter unit 560 in fact forms the output video signal 480. It is also buffered in one or more image stores 570; the storage of successive images is a requirement of motion compensated prediction processing, and in particular the generation of motion vectors. To save on storage requirements, the stored images in the image stores 570 may be held in a compressed form and then decompressed for use in generating motion vectors. For this particular purpose, any known compression/decompression system may be used. The stored images are passed to an interpolation filter 580 which generates a higher resolution version of the stored images; in this example, intermediate samples (sub-samples) are generated such that the resolution of the interpolated image is output by the interpolation filter 580 is 8 times (in each dimension) that of the images stored in the image stores 570. The interpolated images are passed as an input to the motion estimator 550 and also to the motion compensated predictor 540.
In embodiments of the invention, a further optional stage is provided, which is to multiply the data values of the input video signal by a factor of four using a multiplier 600 (effectively just shifting the data values left by two bits), and to apply a corresponding divide operation (shift right by two bits) at the output of the apparatus using a divider or right-shifter 610. So, the shifting left and shifting right changes the data purely for the internal operation of the apparatus. This measure can provide for higher calculation accuracy within the apparatus, as the effect of any data rounding errors is reduced.
The way in which an image is partitioned for compression processing will now be described. At a basic level, and image to be compressed is considered as an array of blocks of samples. For the purposes of the present discussion, the largest such block under consideration is a so-called largest coding unit (LCU) 700 (
Three basic types of blocks will be described: coding units, prediction units and transform units. In general terms, the recursive subdividing of the LCUs allows an input picture to be partitioned in such a way that both the block sizes and the block coding parameters (such as prediction or residual coding modes) can be set according to the specific characteristics of the image to be encoded.
The LCU may be subdivided into so-called coding units (CU). Coding units are always square and have a size between 8×8 samples and the full size of the LCU 700. The coding units can be arranged as a kind of tree structure, so that a first subdivision may take place as shown in
The intra-prediction process will now be discussed. In general terms, intra-prediction involves generating a prediction of a current block (a prediction unit) of samples from previously-encoded and decoded samples in the same image.
The block 810 represents an LCU; as discussed above, for the purposes of intra-image prediction processing, this may be subdivided into a set of smaller prediction units. An example of a prediction unit 830 is shown within the LCU 810.
The intra-image prediction takes into account samples above and/or to the left of the current LCU 810. Source samples, from which the required samples are predicted, may be located at different positions or directions relative to a current prediction unit within the LCU 810. To decide which direction is appropriate for a current prediction unit, the results of a trial prediction based upon each candidate direction are compared in order to see which candidate direction gives an outcome which is closest to the corresponding block of the input image. The candidate direction giving the closest outcome is selected as the prediction direction for that prediction unit.
The picture may also be encoded on a “slice” basis. In one example, a slice is a horizontally adjacent group of LCUs. But in more general terms, the entire residual image could form a slice, or a slice could be a single LCU, or a slice could be a row of LCUs, and so on. Slices can give some resilience to errors as they are encoded as independent units. The encoder and decoder states are completely reset at a slice boundary. For example, intra-prediction is not carried out across slice boundaries; slice boundaries are treated as image boundaries for this purpose.
Note that in some embodiments, the coefficients may be scanned in a reverse order (bottom right to top left using the ordering notation of
The CABAC encoder operates in respect of binary data, that is to say, data represented by only the two symbols 0 and 1. The encoder makes use of a so-called context modelling process which selects a “context” or probability model for subsequent data on the basis of previously encoded data. The selection of the context is carried out in a deterministic way so that the same determination, on the basis of previously decoded data, can be performed at the decoder without the need for further data (specifying the context) to be added to the encoded datastream passed to the decoder.
Referring to
The binary data may then be handled by one of two processing paths, a “regular” and a “bypass” path (which are shown schematically as separate paths but which, in embodiments of the invention discussed below, could in fact be implemented by the same processing stages, just using slightly different parameters). The bypass path employs a so-called bypass coder 920 which does not necessarily make use of context modelling in the same form as the regular path. In some examples of CABAC coding, this bypass path can be selected if there is a need for particularly rapid processing of a batch of data, but in the present embodiments two features of so-called “bypass” data are noted: firstly, the bypass data is handled by the CABAC encoder (950, 960), just using a fixed context model representing a 50% probability; and secondly, the bypass data relates to certain categories of data, one particular example being coefficient sign data. Otherwise, the regular path is selected by schematic switches 930, 940. This involves the data being processed by a context modeller 950 followed by a coding engine 960.
The entropy encoder shown in
Further levels of map data are also prepared and are CABAC encoded. An example is a map which defines, as a binary value (1=yes, 0=no) whether the coefficient data at a map position which the significance map has indicated to be “non-zero” actually has the value of “one”. Another map specifies whether the coefficient data at a map position which the significance map has indicated to be “non-zero” actually has the value of “two”. A further map indicates, for those map positions where the significance map has indicated that the coefficient data is “non-zero”, whether the data has a value of “greater than two”. Another map indicates, again for data identified as “non-zero”, the sign of the data value (using a predetermined binary notation such as 1 for +, 0 for −, or of course the other way around).
In embodiments of the invention, the significance map and other maps are generated from the quantised DCT coefficients, for example by the scan unit 360, and is subjected to a zigzag scanning process (or a scanning process selected from zigzag, horizontal raster and vertical raster scanning according to the intra-prediction mode) before being subjected to CABAC encoding.
In general terms, CABAC encoding involves predicting a context, or a probability model, for a next bit to be encoded, based upon other previously encoded data and/or data elements having nearby positions, in an array of data elements, to that of the current data element. If the next bit is the same as the bit identified as “most likely” by the probability model, then the encoding of the information that “the next bit agrees with the probability model” can be encoded with great efficiency. It is less efficient to encode that “the next bit does not agree with the probability model”, so the derivation of the context data is important to good operation of the encoder. The term “adaptive” means that the context or probability models are adapted, or varied during encoding, in an attempt to provide a good match to the (as yet uncoded) next data.
Using a simple analogy, in the written English language, the letter “U” is relatively uncommon. But in a letter position immediately after the letter “Q”, it is very common indeed. So, a probability model might set the probability of a “U” as a very low value, but if the current letter is a “Q”, the probability model for a “U” as the next letter could be set to a very high probability value.
CABAC encoding is used, in the present arrangements, for at least the significance map and the maps indicating whether the non-zero values are one or two. Bypass processing—which in these embodiments is identical to CABAC encoding but for the fact that the probability model is fixed at an equal (0.5:0.5) probability distribution of 1s and 0s, is used for at least the sign data and the map indicating whether a value is >2. For those data positions identified as >2, a separate so-called escape data encoding can be used to encode the actual value of the data. This may include a Golomb-Rice encoding technique.
Accordingly, the CABAC process and the CAVLC process as applied to the data under discussion here are examples of a video data encoding technique (as implemented in the present embodiments by the apparatus to be described), in which arrays of frequency domain video data, reordered for encoding (by, for example, the scanning process described in this description), are encoded using encoding parameters (for example, a context variable) in respect of a current array element which are derived from previously encoded array elements and/or array elements having nearby positions, in the array of video data, to that of the current array element.
The CABAC context modelling and encoding process is described in more detail in WD4: Working Draft 4 of High-Efficiency Video Coding, JCTVC-F803_d5, Draft ISO/IEC 23008-HEVC; 201x(E) 2011-10-28.
As with CABAC discussed above, the entropy encoding process shown in
Referring to
In CAVLC, data elements are encoded according to a “context” which may be derived from previously encoded data elements and/or spatially nearby data elements (or data elements nearby, in an array of data elements).
As mentioned above, a default scanning order for the scanning operation carried out by the scan unit 360 is a zigzag scan is illustrated schematically in
However, in embodiments of the present invention, different scanning orders can be employed. The choice between scanning orders can be made in various different ways, instances of which will be described below. For example, a choice may be made according to the prediction direction (mode) established for intra-coding, as discussed above with reference to the set of modes illustrated in
In embodiments of the invention, these variations apply to the use of arithmetic coding techniques such as CABAC entropy encoding and to CAVLC entropy encoding.
The following arrangements will be described in the context of an example video data encoding apparatus (such as that described above) in which arrays of video data are reordered for entropy encoding, the apparatus comprising: a frequency domain converter (such as the transform unit 340) for generating a frequency domain representation of data derived from an input video signal, the frequency domain representation comprising an array of plural frequency domain coefficients in respect of each image area (the array elements to be encoded by embodiments of the invention depending on the frequency domain coefficients); a selector (for example, associated with the scan unit 360, an example being discussed below with reference to
Correspondingly, the techniques may be applied to a data decompression apparatus and method. As discussed above, the inverse scanning and entropy decoding techniques are complementary to the scanning and encoding techniques. The same scan pattern needs to be selected as that used in the encoding side, either on the basis of data (such as a data flag) associated with or forming part of the video signal to be decoded, or on the basis of other encoding parameter data such as the encoding direction (which is also flagged within the video signal to be decoded). Frequency conversion at the decoder is complementary to that carried out at the encoder.
In embodiments of the invention the candidate reordering patterns may include at least one reordering pattern selected from the set consisting of the first reordering pattern, the second reordering pattern and the third reordering pattern described in the present description.
As discussed above, it has been noted that the transforms of residual image data (the difference between an image and a predicted version of the image) often contain frequency content perpendicular to the direction of prediction. A concave scan order of the type shown in
Techniques for selecting between the different potential scanning orders will be discussed below.
The horizontal hybrid zig scanning order of
The hybrid zig scanning orders allow for a complete scan of one lowest-vertical-frequency row or one lowest-horizontal-frequency column of the array of coefficients (or, potentially, an adjacent group of more than one such row or column including the row or column defined above), followed by zig scanning of the remaining coefficients. This is based on the empirical observation that near to a horizontal or vertical intra-prediction direction, there is often noise (non-zero data values, not necessarily representing true image content) in the coefficients perpendicular to the prediction direction. Therefore, to gather together all of these noise-based coefficients, a scan of the row or column perpendicular to the intra-prediction direction can be advantageous and lead to a more efficient entropy encoding process.
It has also been noted empirically that similar trends can be observed for other intra-prediction directions, but because the noise can be more widely distributed amongst the array of coefficients, the advantages of using hybrid zig scanning are reduced.
For large block sizes (for example, 64×64 or 32×32), the hybrid zig scan orders discussed above are not considered to be “throughput friendly”, which is to say that they do not necessarily lend themselves to parallel operation. The term “throughput friendly” in fact relates to the use of so-called “speculation” in the decoding process. In basic terms, the decoding of a particular data value (such as a quantised DCT coefficient) can be affected by the decoding of neighbouring data values. For example, in the CABAC system, the context value and assigned code value used as part of the encoding and decoding process can depend on the data values of spatially nearby previously-encoded coefficient data, as well as on the decoding parameters of data which are nearby in a coding order. At the decoding side, if the data are decoded in a serial order identical to the order in which they were encoded, and the decoding of one data item is completed before any related data is needed for the decoding of a next data item, then there is no difficulty with knowing the values of the previously-encoded data in order to generate the required context data for the decoding of a next data item. But if the data values are decoded in parallel, difficulties can arise.
In such a parallel decoding operation, decoding will be handled other than in this simple serial order, and the decoded results of previous encodings may not be available in time to be used as part of a next decoding. Therefore, “speculation” is used to generate a set of possible outcomes of the decoding of a required nearby data value, before the actual data value is decoded, so as to decode a set of options for the decoded value of a current data item. So, the set of options represents the set of possible decodings of the current data value, given the possible (and as yet unknown) outcome of the decoding of the previous data item. When the required nearby data value is eventually decoded, the correct one of the set of options is selected. So, this can be quicker than the simple serial decoding order mentioned above, because by the time the decoded result of the previous encoding is known, all that remains to do in respect of a next decoded item is to select a correct one of the pre-prepared set of options.
But of course, speculation does have penalties, in particular that the greater the level of speculation, that is, the larger the number of linked inter-dependent decoding results which are handled in this way, the greater the number of permutations of possible outcomes. So, a greater level of speculation, particularly in the context of a hardware based system, can bring the penalty that an exponentially increasing number of speculative decoders is required to generate the sets of options.
Accordingly, it is desirable to aim to limit or reduce the need for speculation.
In terms of the dependence of CABAC parameter values such as contexts on spatially neighbouring coefficients, the need for speculation can potentially be reduced by the choice of scanning order, so that the decoding results of the neighbouring coefficients are known in good time before the decoding processes which depend on those results are carried out.
In these instances, and with the aim of reducing speculation and/or increasing encoding efficiency, a zigzag scan order may be considered desirable for encoding the significance map in CABAC systems. However, in embodiments of the invention a hybrid zig scan can be used to detect the position in the array of coefficients of the end of block flag (indicative of a last non-zero data item in the scan order), and then a modified zigzag scan can be used to encode the data values in the significance map as far as the last data item identified by the initial hybrid scan. An example of such an arrangement is shown schematically in
In these embodiments, the end of block (or end of block flag) may be considered as the last non-zero data item in the array, in a scanning order. In the case of the significance map (which indicates zero or non-zero for the coefficients) the end of block is signified simply as the last non-zero entry (the last data item) in the significance map. In the embodiments to be described, the data scanner 360 acts as a last data item detector for searching a current array for a last non-zero array element according to a searching pattern which searches array elements in one or more sets of a constant horizontal spatial frequency or a constant vertical spatial frequency respectively followed by any remaining array elements of the array ordered according to successive subsets, each subset being selected so that the sum of a horizontal spatial frequency component and a vertical spatial frequency component is generally constant for array elements within a subset. It then acts as a data scanner for changing the order of the array elements for entropy encoding according to a reordering pattern so as to generate reordered array elements comprising successive subsets, each subset being selected so that the sum of a horizontal spatial frequency component and a vertical spatial frequency component is generally constant for array elements within a subset, the reordering pattern terminating with the last non-zero array element detected by the last data item detector. The searching operation therefore takes place according to a horizontal scan, a vertical scan, a hybrid horizontal zig scan or a hybrid vertical zig scan. The reordering operation therefore takes place according to a zig scan. The searching and/or reordering patterns can be selected according to the techniques described below for selecting scanning patterns according to image prediction parameters, data parameters and/or trial encodings.
Referring to
In the special case that the end of block marker is found in the top row, then the scan of
The arrangements of
These arrangements have been found to provide a better result with less need for speculation.
In embodiments of the invention, the dual-stage scan arrangements (identify the last data item, then scan with a zig scan) can be used in place of a zigzag scan in the arrangements defined in
Various techniques can be used to select the appropriate scan order from a set of two or more candidate scan patterns for use in respect of a block of coefficients. For example, the last data item detector and the data scanner can be configured to select a searching order and/or a reordering pattern in dependence upon one or more parameters used by the image predictor in generating the predicted version of the current image. Such parameters may comprise an image direction representing a prediction direction relating to an intra-image prediction, and/or an image direction representing a motion direction indicative of image motion detected between the current image and another image.
For example, the use of the concave scan orders described above may be selected in dependence upon the detection of a metric in respect of the different candidate scanning orders (for example: horizontal, vertical, horizontal first concave, vertical first concave, zig-zag) that sums the number of occurrences of non-zero coefficients in a particular map to be encoded, weighted by the square of their ‘distance’ (their separation in the order at which they are processed in the candidate scan order). The number of non-zero coefficients is of course the same for a particular block, independent of the scan order, but the weighted sum mentioned above may be different from scan order to scan order. The scan order giving the lowest weighted sum is selected. This effectively penalises (discourages the selection of) scan orders that introduce runs of zeros between significant coefficients.
However, more generally, the choices can be amongst a set of candidate scan orders including at least one of: a concave scan order, a hybrid zig scan order, and a rectangular scan order, as described above. For example, the hybrid zig scan order (also referred to generically as the second reordering pattern) may be selected for image areas having a predominantly horizontal or vertical image direction (for example, an intra-prediction direction or a motion vector direction), a horizontal hybrid pattern being selected for a predominantly vertical image direction, and vice versa. A concave scan order (also referred to generically as the first reordering pattern) may be selected in respect of a predominantly horizontal or vertical image direction. Here, predominantly horizontal or predominantly vertical could mean, for example, within a predetermined number of (such as one, though other numbers from zero upwards could be used) intra prediction modes (or the equivalent angular range) of horizontal or vertical. The first subset (horizontal first or vertical first) could be selected so that a horizontal first arrangement is used for a predominantly horizontal image direction, and vice versa. A rectangular scan order (also referred to generically as a third reordering pattern) may be selected in respect of a predominantly diagonal image direction. Here, predominantly diagonal could mean, for example, within a predetermined number of (for example, one, though other numbers, from zero upwards could be used) intra prediction modes of a mode at 45 degrees to the horizontal or vertical, or the equivalent angular range.
A scan order generator 1200 receives data from the intra-mode selector 520 defining the selected intra-prediction mode for the current block. With reference to a lookup table 1210, the scan order generator 1200 selects a scan order and passes data to the scan unit 360 defining the selected scan order.
The derivation of scan order with respect to motion vector direction can be carried out using the same underlying techniques as those described with reference to
It will be appreciated that it is not necessarily the case that all scan orders have to be tested using the arrangement of
Finally,
Thus, the foregoing discussion discloses and describes merely exemplary embodiments of the present invention. As will be understood by those skilled in the art, the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. Accordingly, the disclosure of the present invention is intended to be illustrative, but not limiting of the scope of the invention, as well as other claims. The disclosure, including any readily discernible variants of the teachings herein, defines, in part, the scope of the foregoing claim terminology such that no inventive subject matter is dedicated to the public.
Number | Date | Country | Kind |
---|---|---|---|
1119177.2 | Nov 2011 | GB | national |
The present application claims the benefit of the earlier filing date of GB1119177.2 filed in the United Kingdom Intellectual Property Office on 7 Nov. 2011, the entire content of which application is incorporated herein by reference.