Abstract:
The method for scanning a transform coefficient of the present invention comprises the steps of: determining a reference transform block for a block to be decoded; deriving a scanning map of the block to be decoded using scanning information of the reference transform block; and executing a reverse-scan on the transform coefficient of the block to be decoded using the derived scanning map. The present invention enhances image encoding/decoding efficiency.

Description:
BACKGROUND OF THE INVENTION 
       [0001]    1. Field of the Invention 
         [0002]    The present invention relates to picture processing, and more particularly, to a transform coefficient scanning method and apparatus. 
         [0003]    2. Related Art 
         [0004]    Recently, in accordance with the expansion of broadcasting services having high definition (HD) resolution in the country and around the world, many users have been accustomed to a high resolution and high definition picture, such that many organizations have attempted to develop the next-generation picture devices. In addition, as the interest in HDTV and ultra high definition (UHD) having a resolution four times higher than that of HDTV have increased, a compression technology for a higher-resolution and higher-definition picture has been demanded. 
         [0005]    As the picture compression technology, there are an inter prediction technology of predicting pixel values included in a current picture from a picture before and/or after the current picture, an intra prediction technology of predicting pixel values included in a current picture using pixel information in the current picture, a transform technology of decomposing an original picture signal into a signal of a frequency domain, an inverse transform technology of reconstructing a signal of a frequency domain into an original picture signal, an entropy-encoding technology of allocating a short code to symbols having a high appearance frequency and a long code to symbols having a low appearance frequency, and the like. 
       SUMMARY OF THE INVENTION 
       [0006]    The present invention provides a picture encoding method and apparatus capable of improving picture encoding/decoding efficiency. 
         [0007]    The present invention also provides a picture decoding method and apparatus capable of improving picture encoding/decoding efficiency. 
         [0008]    The present invention also provides a transform coefficient scanning method and apparatus capable of improving picture encoding/decoding efficiency. 
         [0009]    1. In an aspect, a transform coefficient scan method is provided. The transform coefficient scan method includes: determining a reference transform block for a decoding target block; deriving a scanning map of the decoding target block using scanning information of the reference transform block; and performing inverse scanning on a transform coefficient of the decoding target block using the derived scanning map. 
         [0010]    2. In 1, in the determining of the reference transform block, a block present at a position that is the spatially same as that of the decoding target block in a reference picture may be determined as the reference transform block. 
         [0011]    3. In 1, in the determining of the reference transform block, at least one of reconstructed neighboring blocks may be determined as the reference transform block, wherein the reconstructed neighboring blocks includes an upper neighboring block adjacent to an upper portion of the decoding target block, a left neighboring block adjacent to the left of the decoding target block, a right upper corner block positioned at a right upper corner of the decoding target block, a left upper corner block positioned at a left upper corner of the decoding target block, and a left lower corner block positioned at a left lower cornet of the decoding target block. 
         [0012]    4. In 3, in the determining of the reference transform block, a block having the same size as that of the decoding target block may be determined as the reference transform block. 
         [0013]    5. In 3, in the determining of the reference transform block, a block having the same depth as that of the decoding target block may be determined as the reference transform block. 
         [0014]    6. In 3, in the determining of the reference transform block, a block having the same encoding parameter as that of the decoding target block may be determined as the reference transform block, wherein the encoding parameter includes at least one of information on an intra prediction direction, a reference picture list, a reference picture index, a motion vector predictor, whether or not a motion information merge is used, whether or not a skip mode is used, a transform kind. 
         [0015]    7. In 1, the deriving of the scanning map may include: determining transform coefficient flag values for positions of each transform coefficient in the reference transform block; deriving a counter map for the decoding target block by calculating flag counter values for the positions of each transform coefficient in the reference transform block based on the transform coefficient flag; and generating the scanning map by allocating scan indices to positions of each transform coefficient in the counter map in an ascending order in a sequence in which the flag counter value is high one by one, wherein the transform coefficient flag is a flag indicating whether or not each transform coefficient in the reference transform block is a non-zero transform coefficient, and the flag counter is the sum of the transform coefficient flag values present at the same position in the case in which all of the reference transform blocks are overlapped with each other. 
         [0016]    8. In 7, in the case in which a size of the reference transform block is different from that of the decoding target block, the determining of the transform coefficient flag values may include: scaling the reference transform block; and determining transform coefficient flag values for positions of each transform coefficient in the scaled reference transform block, and the deriving of the counter map may include deriving the counter map based on the transform coefficient flag in the scaled reference transform block. 
         [0017]    9. In 7, in the generating of the scanning map, the scan indices may be allocated based on a zigzag scan sequence. 
         [0018]    10. In another aspect, a picture decoding apparatus is provided. The picture decoding apparatus includes: an inverse scanning unit determining a reference transform block for a decoding target block, deriving a scanning map of the decoding target block using scanning information of the reference transform block, and performing inverse scanning on a transform coefficient of the decoding target block using the derived scanning map; and a reconstructed picture generating unit generating a reconstructed picture based on the inversely scanned transform coefficient. 
         [0019]    11. In still another aspect, a picture decoding method is provided. The picture decoding method includes: determining a reference transform block for a decoding target block; deriving a scanning map of the decoding target block using scanning information of the reference transform block; performing inverse scanning on a transform coefficient of the decoding target block using the derived scanning map; and generating a reconstructed picture based on the inversely scanned transform coefficient. 
         [0020]    12. In 11, the deriving of the scanning map may include: determining transform coefficient flag values for positions of each transform coefficient in the reference transform block; deriving a counter map for the decoding target block by calculating flag counter values for the positions of each transform coefficient in the reference transform block based on the transform coefficient flag; and generating the scanning map by allocating scan indices to positions of each transform coefficient in the counter map in an ascending order in a sequence in which the flag counter value is high one by one, wherein the transform coefficient flag is a flag indicating whether or not each transform coefficient in the reference transform block is a non-zero transform coefficient, and the flag counter is the sum of the transform coefficient flag values present at the same position in the case in which all of the reference transform blocks are overlapped with each other. 
         [0021]    13. In 12, in the case in which a size of the reference transform block is different from that of the decoding target block, the determining of the transform coefficient flag values may include: scaling the reference transform block; and determining transform coefficient flag values for positions of each transform coefficient in the scaled reference transform block, and the deriving of the counter map may include deriving the counter map based on the transform coefficient flag in the scaled reference transform block. 
         [0022]    14. In 12, in the generating of the scanning map, the scan indices may be allocated based on a zigzag scan sequence. 
         [0023]    With the picture encoding method according to the exemplary embodiment of the present invention, picture encoding/decoding efficiency may be improved. 
         [0024]    With the picture decoding method according to the exemplary embodiment of the present invention, picture encoding/decoding efficiency may be improved. 
         [0025]    With the transform coefficient scanning method according to the exemplary embodiment of the present invention, picture encoding/decoding efficiency may be improved. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0026]      FIG. 1  is a block diagram showing a configuration of a picture encoding apparatus according to an exemplary embodiment of the present invention. 
           [0027]      FIG. 2  is a block diagram showing a configuration of a picture decoding apparatus according to an exemplary embodiment of the present invention. 
           [0028]      FIG. 3  is a conceptual diagram schematically showing an example in which a single block is divided into a plurality of sub-blocks. 
           [0029]      FIG. 4  is a flow chart schematically showing an example of a method of scanning a transform coefficient in an encoder according to an exemplary embodiment of the present invention. 
           [0030]      FIG. 5  is a flow chart schematically showing an example of a method of scanning a transform coefficient in a decoder according to an exemplary embodiment of the present invention. 
           [0031]      FIG. 6  is a conceptual diagram schematically showing an example of a method of selecting reference transform block according to an exemplary embodiment of the present invention. 
           [0032]      FIG. 7  is a conceptual diagram schematically showing another example of a method of selecting a reference transform block according to an exemplary embodiment of the present invention. 
           [0033]      FIG. 8  is a conceptual diagram schematically showing still another example of a method of selecting a reference transform block according to an exemplary embodiment of the present invention. 
           [0034]      FIG. 9  is a conceptual diagram schematically showing still another example of a method of selecting a reference transform block according to an exemplary embodiment of the present invention. 
           [0035]      FIG. 10  is a conceptual diagram schematically showing still another example of a method of selecting a reference transform block according to an exemplary embodiment of the present invention. 
           [0036]      FIG. 11  is a conceptual diagram schematically showing still another example of a method of selecting a reference transform block according to an exemplary embodiment of the present invention. 
           [0037]      FIG. 12  is a flow chart schematically showing an example of a method of deriving a scanning map for an encoding target block. 
           [0038]      FIG. 13  is a conceptual diagram schematically showing an example of a method of determining a transform coefficient flag value according to an exemplary embodiment of the present invention. 
           [0039]      FIG. 14  is a conceptual diagram schematically showing another example of a method of determining a transform coefficient flag value according to an exemplary embodiment of the present invention. 
           [0040]      FIG. 15  is a conceptual diagram schematically showing an example of a method of deriving a transform coefficient counter map according to an exemplary embodiment of the present invention. 
           [0041]      FIG. 16  is a conceptual diagram schematically showing an example of a method of generating a scanning map according to an exemplary embodiment of the present invention. 
           [0042]      FIG. 17  is a conceptual diagram schematically showing an example of a method of scanning/inverse scanning a transform coefficient of an encoding target block using a scanning map. 
       
    
    
     DESCRIPTION OF EXEMPLARY EMBODIMENTS 
       [0043]    Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings. In describing exemplary embodiments of the present invention, well-known functions or constructions will not be described in detail since they may unnecessarily obscure the understanding of the present invention. 
         [0044]    It will be understood that when an element is simply referred to as being ‘connected to’ or ‘coupled to’ another element without being ‘directly connected to’ or ‘directly coupled to’ another element in the present description, it may be ‘directly connected to’ or ‘directly coupled to’ another element or be connected to or coupled to another element, having the other element intervening therebetween. Further, in the present invention, “comprising” a specific configuration will be understood that additional configuration may also be included in the embodiments or the scope of the technical idea of the present invention. 
         [0045]    Terms used in the specification, ‘first’, ‘second’, etc. can be used to describe various components, but the components are not to be construed as being limited to the terms. The terms are only used to differentiate one component from other components. For example, the ‘first’ component may be named the ‘second’ component and the ‘second’ component may also be similarly named the ‘first’ component, without departing from the scope of the present invention. 
         [0046]    Furthermore, constitutional parts shown in the embodiments of the present invention are independently shown so as to represent different characteristic functions. Thus, it does not mean that each constitutional part is constituted in a constitutional unit of separated hardware or one software. In other words, each constitutional part includes each of enumerated constitutional parts for convenience of explanation. Thus, at least two constitutional parts of each constitutional part may be combined to form one constitutional part or one constitutional part may be divided into a plurality of constitutional parts to perform each function. The embodiment where each constitutional part is combined and the embodiment where one constitutional part is divided are also included in the scope of the present invention, if not departing from the essence of the present invention. 
         [0047]    In addition, some of constituents may not be indispensable constituents performing essential functions of the present invention but be selective constituents improving only performance thereof. The present invention may be implemented by including only the indispensable constitutional parts for implementing the essence of the present invention except the constituents used in improving performance. The structure including only the indispensable constituents except the selective constituents used in improving only performance is also included in the scope of the present invention. 
         [0048]      FIG. 1  is a block diagram showing a configuration of a picture encoding apparatus according to an exemplary embodiment of the present invention. 
         [0049]    Referring to  FIG. 1 , a picture encoding apparatus  100  includes a motion estimator  111 , a motion compensator  112 , an intra predictor  120 , a switch  115 , a subtracter  125 , a transformer  130 , a quantizer  140 , an entropy-encoder  150 , a dequantizer  160 , an inverse transformer  170 , an adder  175 , a filter unit  180 , and a reference picture buffer  190 . 
         [0050]    The picture encoding apparatus  100  may perform encoding on input pictures in an intra-mode or an inter-mode and output bit streams. In the case of the intra mode, the switch  115  may be switched to intra, and in the case of the inter mode, the switch  115  may be switched to inter. The picture encoding apparatus  100  may generate a prediction block for an input block of the input pictures and then encode a residual between the input block and the prediction block. 
         [0051]    In the case of the intra mode, the intra predictor  120  may perform spatial prediction using pixel values of blocks encoded in advance around a current block to generate the prediction block. 
         [0052]    In the case of the inter mode, the motion estimator  111  may search a region optimally matched with the input block in a reference picture stored in the reference picture buffer  190  during a motion prediction process to obtain a motion vector. The motion compensator  112  may perform motion compensation using the motion vector to generate the prediction block. 
         [0053]    The subtracter  125  may generate a residual block by the residual between the input block and the generated prediction block. The transformer  130  may perform transform on the residual block to output transform coefficients. Here, the transform coefficient means a coefficient value generated by performing transform on the residual block and/or a residual signal. Hereinafter, in the present specification, quantization is applied to the transform coefficient, such that a quantized transform coefficient level may also be called a transform coefficient. 
         [0054]    The quantizer  140  may quantize the input transform coefficient according to quantization parameters to output a quantized transform coefficient level. 
         [0055]    The entropy-encoder  150  may perform entropy-encoding based on values calculated in the quantizer  140  or encoding parameter values, or the like, calculated during the encoding process to output bit streams. 
         [0056]    When the entropy-encoding is applied, symbols are represented by allocating a small number of bits to symbols having high generation probability and allocating a large number of bits to symbols having low generation probability, thereby making it possible to reduce a size of bit streams for the encoding target symbols. Therefore, the compression performance of the picture encoding may be improved through the entropy-encoding. The entropy-encoder  150  may use an encoding method such as exponential golomb, context-adaptive variable length coding (CAVLC), context-adaptive binary arithmetic coding (CABAC), or the like, for the entropy-encoding. 
         [0057]    Since the picture encoding apparatus according to the exemplary embodiment of  FIG. 1  performs inter prediction encoding, that is, inter-picture prediction encoding, a current encoded picture needs to be decoded and stored in order to be used as a reference picture. Therefore, the quantized coefficient is dequantized in the dequantizer  160  and inversely transformed in the inverse transformer  170 . The dequantized and inversely transformed coefficient is added to the prediction block through the adder  175 , such that a reconstructed block is generated. 
         [0058]    The reconstructed block passes through the filter unit  180  and the filter unit  180  may apply at least one of a deblocking filter, a sample adaptive offset (SAO), and an adaptive loop filter (ALF) to a reconstructed block or a reconstructed picture. The reconstructed block passing through the filter unit  180  may be stored in the reference picture buffer  190 . 
         [0059]      FIG. 2  is a block diagram showing a configuration of a picture decoding apparatus according to an exemplary embodiment of the present invention. 
         [0060]    Referring to  FIG. 2 , a picture decoding apparatus  200  includes an entropy-decoder  210 , a dequantizer  220 , an inverse transformer  230 , an intra predictor  240 , a motion compensator  250 , an adder  255 , a filter unit  260 , and a reference picture buffer  270 . 
         [0061]    The picture decoding apparatus  200  may receive the bit streams output from the encoder to perform the decoding in the intra mode or the inter mode and output the reconstructed picture, that is, a recovered picture. In the case of the intra mode, the switch may be switched to the intra, and in the case of the inter mode, the switch may be switched to the inter. The picture decoding apparatus  200  may obtain a reconstructed residual block from the received bit streams, generate the prediction block, and then add the reconstructed residual block to the prediction block to generate the reconstructed block, that is, a recovered block. 
         [0062]    The entropy-decoder  210  may entropy-decode the input bit streams according to the probability distribution to generate symbols including a quantized coefficient type of symbols. The entropy-decoding method is similar to the above-mentioned entropy encoding method. 
         [0063]    When the entropy-decoding method is applied, symbols are represented by allocating a small number of bits to symbols having high generation probability and allocating a large number of bits to symbols having low generation probability, thereby making it possible to reduce a size of bit streams for each symbol. Therefore, the picture decoding compression performance may be improved through the entropy-decoding method. 
         [0064]    The quantized coefficients may be dequantized in the dequantizer  220  and be inversely transformed in the inverse transformer  230 . The quantized coefficients are dequantized/inversely transformed, such that the reconstructed residual block may be generated. 
         [0065]    In the case of the intra mode, the intra predictor  240  may perform spatial prediction using pixel values of blocks encoded in advance around a current block to generate the prediction block. In the case of the inter mode, the motion compensator  250  may perform the motion compensation using the motion vector and the reference picture stored in the reference picture buffer  270  to generate the prediction block. 
         [0066]    The reconstructed residual block and the prediction block may be added to each other through the adder  255  and the added block may pass through the filter unit  260 . The filter unit  260  may apply at least one of the deblocking filter, the SAO, and the ALF to the reconstructed block or the reconstructed picture. The filter unit  260  may output the reconstructed picture, that is, a recovered picture. The reconstructed picture may be stored in the reference picture buffer  270  to thereby be used for the inter prediction. 
         [0067]    Hereinafter, a block means a unit of picture encoding and decoding. At the time of the picture coding and decoding, since the encoding or decoding unit means the divided unit when dividing the picture and encoding or decoding the divided pictures, the encoding or decoding unit may be called a macro block, a coding unit (CU), a transform unit (TU), a transform block, or the like. In addition, hereinafter, an encoding/decoding target block means the transform unit and/or the transform block. A single block may be subdivided into sub-blocks having a smaller size. 
         [0068]      FIG. 3  is a conceptual diagram schematically showing an example in which a single block is divided into a plurality of sub-blocks. 
         [0069]    A single block may be hierarchically divided using depth or depth level information based on a tree structure. The respective divided sub-blocks may have a depth value. Here, the depth may indicate the number and/or the degree of divisions of the depth block. Therefore, the depth value may also include information on a size of the sub-block. 
         [0070]    Referring to  310  of  FIG. 3 , an uppermost node may be called a root node and have a smallest depth value. Here, the uppermost node may have a depth of level 0 and indicate an initial block that is not divided. 
         [0071]    A lower node having a depth of level 1 may indicate a block divided once from the initial block, and a lower node having a depth of level 2 may indicate a block divided twice from the initial block. For example, in  320  of  FIG. 3 , a block a corresponding to a node a may be a block divided once from the initial block and have a depth of level 1. 
         [0072]    A leaf node of level 3 may indicate a block divided three times from the initial block. For example, in  320  of  FIG. 3 , a block d corresponding to a node d may be a block divided three times from the initial block and have a depth of level 3. The leaf node of level 3, which is a lowermost node, may have a deepest depth. 
         [0073]    Meanwhile, as described above, the encoder may perform transform on the residual block generated after performing the inter prediction and the intra prediction to generate the transform coefficient. When quantization is performed on the transform coefficient, the quantized transform coefficient level may be generated. 
         [0074]    In the case of the quantized transform coefficient level, it is likely that a non-zero transform coefficient will be distributed in a low frequency region due to characteristics of transform. Here, the non-zero transform coefficient means a transform coefficient having a non-zero value and/or a transform coefficient level having a non-zero value. Therefore, in order to preferentially encode the non-zero transform coefficient level present in the low frequency region, the encoder may perform scanning before performing entropy-encoding on the transform coefficient level in the encoding target block. Here, the scanning means a process of aligning a sequence of transform coefficients in the transform unit and/or the transform block. As a generally used scanning method, there are a zigzag scan method, a field scan method, and the like. 
         [0075]    The decoder may perform entropy-decoding on the transform coefficient level at the time of decoding the picture. Before dequantization and inverse transform are performed on the entropy-decoded transform coefficient level, the decoder may perform inverse scanning in order to determine a position of the decoding target block in which the transform coefficient level is to be included. 
         [0076]    In an existing scanning/inverse scanning method, since characteristics of neighboring blocks, or the like, having characteristics similar to those of the encoding/decoding target block are not sufficiently used, there may be a limitation in improving encoding efficiency. Therefore, in order to improve the encoding efficiency, a picture encoding/decoding method and apparatus of selecting a reference transform block in a context-adaptive scheme and performing scanning/inverse scanning on a transform coefficient of an encoding/decoding target block using scanning/inverse scanning information of the reference transform block may be provided. 
         [0077]      FIG. 4  is a flow chart schematically showing an example of a method of scanning a transform coefficient in an encoder according to an exemplary embodiment of the present invention. 
         [0078]    Referring to  FIG. 4 , the encoder may select a reference transform block for an encoding target block (S 410 ). At this time, the encoder may select blocks other than the encoding target block as the reference transform block, and a size of the selected reference transform block may be N*M (N and M indicate any natural number). 
         [0079]    The selected reference transform block may include scanning information. Therefore, the encoder may obtain the scanning information from the selected reference transform block. Here, the scanning information may include a position of a non-zero transform coefficient in the selected reference transform block, a value of the transform coefficient of the selected reference transform block, and the like. Examples of a method of selecting a reference transform block will be described below. 
         [0080]    Again referring to  FIG. 4 , the encoder may derive a scanning map for the encoding target block using the scanning information on the reference transform block (S 420 ). 
         [0081]    In the selecting of the reference transform block described above, the number of selected reference transform blocks may be one or two ore more. In the case in which two or more reference transform blocks are selected, the encoder may derive the scanning map using the scanning information of the selected two or more reference transform blocks. 
         [0082]    In the selecting of the reference transform block described above, the reference transform block may not also be selected. In the case in which the selected reference transform block is not present, the encoder may determine a predetermined fixed scanning map as a scanning map for the encoding target block. Here, the predetermined fixed scanning map may be a scanning map indicating zigzag scan. Further, in the case in which the selected reference transform block is not present, the encoder may also omit a process of determining the scanning map and perform scanning on the encoding target block using a predetermined fixed scanning method. Here, the predetermined fixed scanning method may be zigzag scan. 
         [0083]    A specific example of a method of deriving the scanning map for the encoding target block using the scanning information of the reference transform block will be described below. 
         [0084]    Again referring to  FIG. 4 , the encoder may perform scanning on a transform coefficient of the encoding target block using the derived scanning map (S 430 ). An example of a method of scanning the transform coefficient of the encoding target block will be described below. 
         [0085]      FIG. 5  is a flow chart schematically showing an example of a method of scanning a transform coefficient in a decoder according to an exemplary embodiment of the present invention. 
         [0086]    Referring to  FIG. 5 , the decoder may select a reference transform block for a decoding target block (S 510 ). At this time, the decoder may select blocks other than the decoding target block as the reference transform block, and a size of the selected reference transform block may be N*M (N and M indicate any natural number). 
         [0087]    The selected reference transform block may include scanning information. Therefore, the decoder may obtain the scanning information from the selected reference transform block. Here, the scanning information may include a position of a non-zero transform coefficient in the selected reference transform block, a value of the transform coefficient of the selected reference transform block, and the like. The decoder may select the reference transform block using the same method as the method used in the encoder, and examples of a method of selecting the reference transform block will be described below. 
         [0088]    Again referring to  FIG. 5 , the decoder may derive a scanning map for the decoding target block using the scanning information on the reference transform block (S 520 ). 
         [0089]    In the selecting of the reference transform block described above, the number of selected reference transform blocks may be one or two ore more. In the case in which two or more reference transform blocks are selected, the decoder may derive the scanning map using the scanning information of the selected two or more reference transform blocks. 
         [0090]    In the selecting of the reference transform block described above, the reference transform block may not also be selected. In the case in which the selected reference transform block is not present, the decoder may determine a predetermined fixed scanning map as a scanning map for the decoding target block. Here, the predetermined fixed scanning map may be a scanning map indicating zigzag scan. Further, in the case in which the selected reference transform block is not present, the decoder may also omit a process of determining the scanning map and perform inverse scanning on the decoding target block using a predetermined fixed scanning method. Here, the predetermined fixed scanning method may be zigzag scan. 
         [0091]    A method of deriving the scanning map for the decoding target block may be the same as the method of deriving the scanning map in the encoder. A specific example of a method of deriving the scanning map for the decoding target block using the scanning information of the reference transform block will be described below. 
         [0092]    Again referring to  FIG. 5 , the decoder may perform inverse scanning on a transform coefficient of the decoding target block using the derived scanning map (S 530 ). An example of a method of inversely scanning the transform coefficient of the encoding target block will be described below. 
         [0093]    Hereinafter, the following examples will be described based on the encoder for convenience. However, unless particularly stated, they may also be applied to the decoder in the same scheme. In this case, the encoding target block may be interpreted as being the decoding target block, and the scanning may be interpreted as being inverse scanning. 
         [0094]      FIG. 6  is a conceptual diagram schematically showing an example of a method of selecting reference transform block according to an exemplary embodiment of the present invention. 
         [0095]    The encoder may select reconstructed neighboring blocks as reference transform blocks for an encoding target block. Here, the reconstructed neighboring blocks, which are blocks previously encoded or decoded to thereby be reconstructed, may include a block adjacent to the encoding/decoding target block, a block positioned at a right upper corner of the encoding/decoding target block, a block positioned at a left upper corner of the encoding/decoding target block, and/or a block positioned at a left lower corner of the encoding/decoding target block. Hereinafter, a block adjacent to an upper portion of the encoding target block will be called an upper neighboring block, and a block adjacent to a left of the encoding target block will be called a left neighboring block. In addition, a block positioned at a right upper corner of the encoding target block will be called a right upper corner block, a block positioned at a left upper corner of the encoding target block will be called a left upper corner block, and a block positioned at a left lower corner of the encoding target block will be called a left lower corner block. 
         [0096]    In the example of  FIG. 6 , a block X indicates an encoding target block, and blocks A, B, C, D, E, F, and G indicate reconstructed neighboring blocks. Referring to  FIG. 6 , the encoder may select at least one of left neighboring blocks A and B, an upper neighboring block D, right upper corner blocks E and F, a left upper corner block G, and a left lower corner block C as the reference transform block. 
         [0097]      FIG. 7  is a conceptual diagram schematically showing another example of a method of selecting a reference transform block according to an exemplary embodiment of the present invention. 
         [0098]      710  of  FIG. 7  indicates a block in an encoding target picture, and  720  of  FIG. 7  indicates a collocated block in a reference picture. Here, the collocated block means a block present at a position that is the spatially same as that of a block in the encoding target picture within the reference picture. A block X shown in  710  of  FIG. 7  indicates an encoding target block. 
         [0099]    The encoder may determine a reference transform block for the encoding target block among blocks in the reference picture. Referring to  FIG. 7 , as an example, the encoder may select at least one of a block T  722  and a block O  724  in the reference picture as the reference transform block. Here, the block T  722  may be a collocated block for the encoding target block, and the block O  724  may be a collocated block for the upper neighboring block. In addition, the encoder may select the block T  722  present at a position that is the spatially same as that of a block in the encoding target picture among the blocks in the reference picture as the reference transform block. 
         [0100]      FIG. 8  is a conceptual diagram schematically showing still another example of a method of selecting a reference transform block according to an exemplary embodiment of the present invention. A block X shown in  FIG. 8  indicates an encoding target block. 
         [0101]    The encoder may select blocks present at predetermined relative positions for the encoding target block as the reference transform block for the encoding target block. Referring to  FIG. 8 , as an example, the encoder may select at least one of a left neighboring block A adjacent to the left of the encoding target block X and an upper neighboring block B adjacent to an upper portion of the encoding target block X as the reference transform block for the encoding target block. 
         [0102]      FIG. 9  is a conceptual diagram schematically showing still another example of a method of selecting a reference transform block according to an exemplary embodiment of the present invention. A block X shown in  FIG. 9  indicates an encoding target block. 
         [0103]    The encoder may select blocks having the same size as that of the encoding target block as the reference transform block for the encoding target block. Here, the reference transform block may be selected among reconstructed neighboring blocks by way of example. 
         [0104]    Referring to  FIG. 9 , the blocks having the same size as the encoding target block X among the reconstructed neighboring block are a left lower corner block C, a left upper corner block G, and an upper neighboring block D. Here, the encoder may determine at least one of the left lower corner block G, the left upper corner block G, and the upper neighboring block D having the same size as that of the encoding target block X as the reference transform block for the encoding target block X. 
         [0105]      FIG. 10  is a conceptual diagram schematically showing still another example of a method of selecting a reference transform block according to an exemplary embodiment of the present invention. A block X shown in  FIG. 10  indicates an encoding target block. 
         [0106]    The encoder may select blocks having the same depth value as that of the encoding target block as the reference transform block for the encoding target block. Here, the reference transform block may be selected among reconstructed neighboring blocks by way of example. 
         [0107]    Referring to  FIG. 10 , the blocks having the same depth value as the encoding target block X among the reconstructed neighboring block are a left lower corner block C, a left upper corner block G, and an upper neighboring block D. Here, the encoder may determine at least one of the left lower corner block C, the left upper corner block G, and the upper neighboring block D having the same depth value as that of the encoding target block X as the reference transform block for the encoding target block X. 
         [0108]      FIG. 11  is a conceptual diagram schematically showing still another example of a method of selecting a reference transform block according to an exemplary embodiment of the present invention. A block X shown in  FIG. 11  indicates an encoding target block. 
         [0109]    The encoder may select blocks having an encoding parameter equal or similar to that of the encoding target block as the reference transform block for the encoding target block. Here, the reference transform block may be selected among reconstructed neighboring blocks by way of example. Here, the encoding parameter may include information that may be inferred during an encoding or decoding process as well as information that is encoded in the encoder and is transmitted to the decoder, such as a syntax element, and means information required when the picture is encoded or decoded. The encoding parameter may include, for example, an intra prediction direction, a block size, a reference picture list, a reference picture index, a motion vector predictor, whether or not a motion information merge is used, whether or not a skip mode is used, a transform kind, and the like. 
         [0110]    In the example of  FIG. 11 , it is assumed that a left neighboring block A and an upper neighboring block B among the reconstructed neighboring blocks have an encoding parameter equal or similar to that of the encoding target block X. Here, the encoder may determine at least one of the left neighboring block A and the upper neighboring block B as the reference transform block for the encoding target block X. 
         [0111]    The block having the encoding parameter equal or similar to that of the encoding target block may be determined by various methods. Hereinafter, examples of the block having the encoding parameter equal or similar to that of the encoding target block will be described. 
         [0112]    As an example, it is likely that a block to which a reference sample or a reference pixel used for intra prediction of the encoding target block belongs will include information equal or similar to that of the encoding target block. Therefore, the encoder may select the block to which the reference sample or the reference pixel used for intra prediction of the encoding target block belongs as the reference transform block for the encoding target block. 
         [0113]    In addition, a motion vector predictor and a motion vector predictor index may be used for inter prediction of the encoding target block. Here, the encoder may select blocks having the same motion vector predictor as that of the encoding target block and the same motion vector predictor index as that of the encoding target block as the reference transform block. The selected reference transform block may have the same motion vector as that of the motion vector predictor for the encoding target block as the motion vector predictor. 
         [0114]    In addition, a reference picture index may be used for inter prediction of the encoding target block. Here, the encoder may select a block having the same reference picture index as that of the encoding target block as the reference transform block. 
         [0115]    In addition, a motion information merge may be used for inter prediction of the encoding target block. In the case in which the motion information merge is used, the encoder may use at least one of spatial motion information derived from the reconstructed neighboring block and temporal motion information derived from the reference picture as motion information of the encoding target block. Here, the spatial motion information and the temporal motion information may be called a merge candidate. In the motion information merge, a merge index indicating which of merge candidates is used as the motion information of the encoding target block may be used. 
         [0116]    Here, the encoder may select a block that becomes a merge target of the encoding target block as the reference transform block for the encoding target block. For example, the encoder may select a block corresponding to the merge target indicated by the merge index of the encoding target block as the reference transform block for the encoding target block. 
         [0117]      FIG. 12  is a flow chart schematically showing an example of a method of deriving a scanning map for an encoding target block. 
         [0118]    As described above, the encoder may derive the scanning map for the encoding target block using the scanning information of the reference transform block. Here, the scanning information may include a position of a non-zero transform coefficient in the reference transform block, a value of the transform coefficient of the selected reference transform block, and the like. 
         [0119]    Referring to  FIG. 12 , the encoder may determine transform coefficient flag values for positions of each transform coefficient in the reference transform block (S  1210 ). 
         [0120]    As an example, a transform coefficient flag value of 1 may be allocated to a position of a non-zero transform coefficient, and a transform coefficient flag value of 0 may be allocated to a position of a transform coefficient that is not the non-zero transform coefficient. In this case, the transform coefficient flag may indicate whether or not the transform coefficient in the reference transform block is the non-zero transform coefficient. 
         [0121]    In addition, in the case in which sizes of the reference transform block and the encoding target block are different, the encoder may scale the reference transform block so as to correspond to a size of the encoding target block. In this case, the encoder may determine the transform coefficient flag values with respect to the positions of each transform coefficient in the scaled reference transform block. 
         [0122]    A specific example of a method of determining the transform coefficient flag value will be described below. 
         [0123]    Again referring to  FIG. 12 , the encoder may derive a transform coefficient counter map for the encoding target block (S  1220 ). 
         [0124]    The encoder may calculate flag counter values for the positions of each transform coefficient in the reference transform block, and the transform coefficient counter map may be derived by the calculated flag counter value. Here, the flag counter means the sum of the transform coefficient flag values present at the same positions in a plurality of reference transform blocks. That is, the flag counter means the sum of the transform coefficient flag values present at the same positions in the case in which the plurality of reference transform blocks are overlapped with each other. 
         [0125]    In addition, as described above, the case in which the sizes of the reference transform block and the encoding target block are different may also be generated. In this case, the encoder may derive the transform coefficient counter map using the transform coefficient flag value of the scaled reference transform block. 
         [0126]    A specific example of a method of deriving the transform coefficient counter map will be described below. 
         [0127]    Again referring to  FIG. 12 , the encoder may generate a scanning map for the encoding target block (S  1230 ). 
         [0128]    The encoder may generate the scanning map by allocating scan indices to each transform coefficient position in the counter map in a sequence in which a flag counter value is high, based on a zigzag scan sequence. Here, the scan index may be allocated in a sequence in which an index value is low, starting from 0. In addition, in the case in which a plurality of positions having the same flag counter value are present, a low scan index value may be allocated to a transform coefficient position at which a priority of the zigzag scan is high. 
         [0129]    A scan index value may be allocated to a plurality of transform coefficient positions having a flag counter value of 0 based on a zigzag scan sequence. In this case, the scan index may be allocated in the zigzag scan sequence and be allocated in a sequence in which an index value is low. 
         [0130]    When the scanning map is generated, the encoder may scan transform coefficients of the encoding target block in a sequence in which the allocated scan index value is low. A specific example of a method of generating the scanning map will be described below. 
         [0131]      FIG. 13  is a conceptual diagram schematically showing an example of a method of determining a transform coefficient flag value according to an exemplary embodiment of the present invention. 
         [0132]      FIG. 13  shows an encoding target block  1310 , a left neighboring block  1320 , and an upper neighboring block  1330 . The left neighboring block  1320  and the upper neighboring block  1330  indicate reference transform blocks selected by the encoder. In the example of  FIG. 13 , it is assumed that each of the encoding target block  1310 , the left neighboring block  1320 , and the upper neighboring block  1330  has a size of 4×4. 
         [0133]    As described above, the encoder may determine the transform coefficient flag values for positions of each transform coefficient in the reference transform block. As an example, a transform coefficient flag value of 1 may be allocated to a position of a non-zero transform coefficient, and a transform coefficient flag value of 0 may be allocated to a position of a transform coefficient that is not the non-zero transform coefficient. In this case, the transform coefficient flag may indicate whether or not the transform coefficient in the reference transform block is the non-zero transform coefficient. In the example of  FIG. 13 , numbers allocated to positions of each transform coefficient in the reference transform block indicate examples of the transform coefficient flag value. 
         [0134]    Referring to  FIG. 13 , in the case of the left neighboring block  1320 , the non-zero transform coefficients are present at first, second, and fourth positions in a raster scan sequence. Therefore, the transform coefficient flag value of 1 may be allocated to the position at which the non-zero transform coefficient is present, and the transform coefficient flag value of 0 may be allocated to the position at which the non-zero transform coefficient is not present. 
         [0135]    Further, in the case of the upper neighboring block  1330 , the non-zero transform coefficients are present at first, second, and sixth positions in a raster scan sequence. Therefore, the transform coefficient flag value of 1 may be allocated to the position at which the non-zero transform coefficient is present, and the transform coefficient flag value of 0 may be allocated to the position at which the non-zero transform coefficient is not present. 
         [0136]      FIG. 14  is a conceptual diagram schematically showing another example of a method of determining a transform coefficient flag value according to an exemplary embodiment of the present invention. 
         [0137]      FIG. 14  shows an encoding target block  1410 , a left neighboring block  1420 , and an upper neighboring block  1430 . The left neighboring block  1420  and the upper neighboring block  1430  indicate reference transform blocks selected by the encoder. In the example of  FIG. 14 , the encoding target block  1410  and the left neighboring block  1420  have a size of 4×4, and the upper neighboring block  1430  has a size of 8×8. 
         [0138]    As described above, in the case in which sizes of the reference transform block and the encoding target block are different, the encoder may scale the reference transform block so as to correspond to a size of the encoding target block. In this case, the encoder may determine the transform coefficient flag values with respect to the positions of each transform coefficient in the scaled reference transform block. 
         [0139]    Referring to  FIG. 14 , the upper neighboring block  1430  among the reference transform blocks may have a size larger than that of the encoding target block  1410 . In the case in which the reference transform block has a size larger than that of the encoding target block, the encoder may scale the reference transform block so as to correspond to the size (4×4) of the encoding target block.  1440  of  FIG. 14  indicates a scaled reference transform block. 
         [0140]    The encoder may determine the transform coefficient flag values with respect to the positions of each transform coefficient in the scaled reference transform block  1440 . To this end, the encoder may group transform coefficient flags present in the reference transform block  1430  before being scaled into a plurality of groups. Here, each of the groups may correspond to each transform coefficient position in the scaled reference transform block  1440 . In this case, when at least one of the transform coefficient flag values included in one specific group is 1, a transform coefficient flag value of 1 may be allocated to a position of a corresponding transform coefficient position (a transform coefficient position in the scaled reference transform block  1440 ). In addition, when all of the transform coefficient flag values included in one specific group are 0, the transform coefficient flag value of 0 may be allocated to a position of corresponding transform coefficient positions (transform coefficient positions in the scaled reference transform block  1440 ). 
         [0141]    Unlike the example of  FIG. 14 , the reference transform block may also have a size smaller that that of the encoding target block. In the case in which the reference transform block has a size smaller than that of the encoding target block, the encoder may scale the reference transform block so as to correspond to the size of the encoding target block. Here, each transform coefficient flag present in the reference transform block before being scaled may correspond to at least one transform coefficient position present in the scaled reference transform block. In this case, the encoder may allocate the transform coefficient flag in the reference transform block before being scaled to a corresponding transform coefficient position (a transform coefficient position in the scaled reference transform block). That is, the transform coefficient flag in the reference transform block before being scaled may be scaled and then allocated to a corresponding position. 
         [0142]      FIG. 15  is a conceptual diagram schematically showing an example of a method of deriving a transform coefficient counter map according to an exemplary embodiment of the present invention. 
         [0143]    In the example of  FIG. 15 , it is assumed that the encoding target block has a size of 4×4 and reference transform blocks and transforms coefficient flag values in each reference transform block are determined to be the same as those of the example of  FIG. 13 . That is, the encoder selects a left neighboring block and an upper neighboring block as the reference transform block. Here, in the case of the left neighboring block, it is assumed that a transform coefficient flag value of 1 is allocated to first, second, and fourth positions in a raster scan sequence, and in the case of the upper neighboring block, it is assumed that a transform coefficient flag value of 1 is allocated to first, second, and sixth positions in a raster scan sequence. 
         [0144]    As described above, the encoder may calculate flag counter values for the positions of each transform coefficient in the reference transform block, and the transform coefficient counter map may be derived by the calculated flag counter value. Here, the flag counter means the sum of the transform coefficient flag values present at the same positions in a plurality of reference transform blocks. That is, the flag counter means the sum of the transform coefficient flag values present at the same positions in the case in which the plurality of reference transform blocks are overlapped with each other. 
         [0145]      FIG. 15  shows an example of a transform coefficient counter map derived according to the exemplary embodiment of the present invention. As described above, in the example of  FIG. 15 , the transform coefficient flag value at the first and second positions of the left neighboring block in the raster scan sequence is 1, and the transform coefficient flag value at the first and second positions of the upper neighboring block in the raster scan sequence is 1. Therefore, the flag counter value of the first position  1510  and the second position  1520  of the transform coefficient counter map in the raster scan sequence may be 2. 
         [0146]    In addition, the transform coefficient flag value of the fourth position in the left neighboring block in the raster scan sequence is 1, and the transform coefficient flag value of the fourth position in the upper neighboring block in the raster scan sequence is 0. Therefore, the flag counter value of the fourth position  1530  of the transform coefficient counter map in the raster scan sequence may be 1. In addition, the transform coefficient flag value of the sixth position in the left neighboring block in the raster scan sequence is 0, and the transform coefficient flag value of the sixth position in the upper neighboring block in the raster scan sequence is 1. Therefore, the flag counter value of the sixth position  1540  of the transform coefficient counter map in the raster scan sequence may be 1. 
         [0147]    Meanwhile, as described above, the case in which the sizes of the reference transform block and the encoding target block are different may also be generated. In this case, the encoder may derive the transform coefficient counter map using the transform coefficient flag value of the scaled reference transform block. 
         [0148]      FIG. 16  is a conceptual diagram schematically showing an example of a method of generating a scanning map according to an exemplary embodiment of the present invention. 
         [0149]    As described above, the encoder may generate the scanning map by allocating the scan indices to each transform coefficient position in the counter map in a sequence in which a flag counter value is high, based on a zigzag scan sequence. In the example of  FIG. 16 , it is assumed that the counter map shown in  FIG. 15  is used for generating the scanning map. 
         [0150]      1610  of  FIG. 16  indicates a zigzag scan sequence. In  1610  of  FIG. 16 , numbers indicated in each transform coefficient position indicate scan index values of the zigzag scan. In the case in which the zigzag scan is applied, the scanning may be performed in a sequence in which the scan index value in  1610  of  FIG. 16  is low. 
         [0151]      1620  of  FIG. 16  indicates a scanning map in which scan indices are allocated, derived according to the exemplary embodiment of the present invention. In  1620  of  FIG. 16 , numbers indicated in each transform coefficient position indicate scan index values. 
         [0152]    Referring to  1620  of  FIG. 16 , the encoder may allocate the scan indices to each transform coefficient position in the counter map in a sequence in which a flag counter value is high. Here, the scan index may be allocated in a sequence in which an index value is low, starting from 0. In addition, in the case in which a plurality of positions having the same flag counter value are present, a low scan index value may be allocated to a transform coefficient position at which a priority of the zigzag scan is high. 
         [0153]    A scan index value may be allocated to a plurality of transform coefficient positions having a flag counter value of 0 based on a zigzag scan sequence. In this case, the scan index may be allocated to each transform coefficient position in the counter map in the zigzag scan sequence and be allocated in a sequence in which an index value is low. 
         [0154]    When the scanning map is generated, the encoder may scan transform coefficients of the encoding target block in a sequence in which the allocated scan index value is low. 
         [0155]      FIG. 17  is a conceptual diagram schematically showing an example of a method of scanning/inverse scanning a transform coefficient of an encoding target block using a scanning map. 
         [0156]      1710  of  FIG. 17  indicates a two-dimensional transform coefficient for the encoding/decoding target block, and  1720  of  FIG. 17  indicates a one-dimensional transform coefficient arrangement corresponding to the two-dimensional transform coefficient. In the example of  FIG. 17 , it is assumed that the scanning map shown in  1620  of  FIG. 16  is used for scanning/inverse scanning. 
         [0157]    Referring to  FIG. 17 , the encoder may scan the transform coefficients of the encoding target block in a sequence in which the scan index value allocated to the scanning map is low. In this case, the two-dimensional transform coefficient  1710  of the encoding target block may be scanned and encoded in a sequence of the one-dimensional transform coefficient arrangement shown in  1720  of  FIG. 17 . 
         [0158]    For example, in  FIG. 17 , since a scan index value 0 is allocated to a transform coefficient  4 , the transform coefficient  4  may be first scanned. In addition, other transform coefficients may also be scanned in a sequence in which the scan index values allocated to each transform coefficient is low. 
         [0159]    The decoder may perform entropy-decoding on the transform coefficient in the sequence of the one-dimensional transform coefficient arrangement shown in  1720  of  FIG. 17  during a decoding process. When the entropy-decoding is performed on the transform coefficient, the decoder performs the inverse scanning on the transform coefficient using the scanning map, thereby making it possible to allocate the transform coefficient to the two-dimensional decoding target block. For example, the decoder may perform inverse scanning on the decoding target block in a sequence in which the scan index value allocated to the scanning map is low. That is, the decoder may allocate the transform coefficient to the two-dimensional decoding target block in a sequence in which the scan index value allocated to the scanning map is low. 
         [0160]    With the above-mentioned examples, the encoder and the decoder may select the reference transform block in a context-adaptive scheme using similarity between the encoding/decoding target block and the reconstructed neighboring block. In this case, the encoder and the decoder perform the scanning/inverse scanning on the transform coefficient in the encoding/decoding target block using the scanning information of the selected reference transform block, thereby making it possible to improve encoding efficiency. 
         [0161]    In the above-mentioned exemplary embodiments, although the methods have described based on a flow chart as a series of steps or blocks, the present invention is not limited to a sequence of steps but any step may be generated in a different sequence or simultaneously from or with other steps as described above. Further, it may be appreciated by those skilled in the art that steps shown in a flow chart is non-exclusive and therefore, include other steps or deletes one or more steps of a flow chart without having an effect on the scope of the present invention. 
         [0162]    The above-mentioned embodiments include examples of various aspects. Although all possible combinations showing various aspects are not described, it may be appreciated by those skilled in the art that other combinations may be made. Therefore, the present invention should be construed as including all other substitutions, alterations and modifications belong to the following claims.