What is claimed is:1. A video encoding method for predicting a target block using a bi-directional optical flow, the method comprising:determining the target block, by partitioning a pre-determined size of block in a tree structure;generating a first motion vector for a first reference picture and a second motion vector for a second reference picture;deriving a variable from sample value differences between samples in the first reference picture which are determined based on the first motion vector and samples in the second reference picture which are determined based on the second motion vector, wherein the variable is SAD (Sum of Absolute Differences) or SSE (Sum of Squared Errors) and is used for determining whether to apply the bi-directional optical flow;generating a prediction block of the target block from the first and second reference pictures, by selectively either applying or skipping the bi-directional optical flow depending on the variable; andencoding partition information related to the tree structure, and residual signals that are differences between samples in the target block and samples in the prediction block,wherein the bi-directional optical flow is performed by the unit of samples in the target block or by the unit of sub-blocks partitioned from the target block.2. The apparatus of claim 1, wherein the bi-directional optical flow is skipped when the variable is less than a predetermined threshold, and is applied when the variable is greater than the predetermined threshold.3. The apparatus of claim 1, wherein, when at least one of a width or a height of the target block is less than a predetermined length, the bi-directional optical flow is skipped.4. The apparatus of claim 3, wherein the predetermined length is 8.5. A video decoding apparatus for predicting a target block using a bi-directional optical flow, the apparatus comprising one or more processor configured to:decode partition information from a bitstream, and determine the target block by partitioning a pre-determined size of block in a tree structure;reconstruct residual signals corresponding to the target block from the bitstream;generate a first motion vector for a first reference picture and a second motion vector for a second reference picture;derive a variable from sample value differences between samples in the first reference picture which are determined based on the first motion vector and samples in the second reference picture which are determined based on the second motion vector, wherein the variable is SAD (Sum of Absolute Differences) or SSE (Sum of Squared Errors) and is used for determining whether to apply the bi-directional optical flow;generate a prediction block of the target block from the first and second reference pictures, by selectively either applying or skipping the bi-directional optical flow depending on the variable; andreconstruct the target block by using samples in the prediction block and the residual signals,wherein the bi-directional optical flow is performed by the unit of samples in the target block or by the unit of sub-blocks partitioned from the target block.6. The method of claim 5, wherein the bi-directional optical flow is skipped when the variable is less than a predetermined threshold, and is applied when the variable is greater than the predetermined threshold.7. The method of claim 5, wherein, when at least one of a width or a height of the target block is less than a predetermined length, the bi-directional optical flow is skipped.8. The method of claim 7, wherein the predetermined length is 8.9. A non-transitory recording medium storing a bitstream generated by a video encoding method for predicting a target block using a bi-directional optical flow, the method comprising:determining the target block, by partitioning a pre-determined size of block in a tree structure;generating a first motion vector for a first reference picture and a second motion vector for a second reference picture;deriving a variable from sample value differences between samples in the first reference picture which are determined based on the first motion vector and samples in the second reference picture which are determined based on the second motion vector, wherein the variable is SAD (Sum of Absolute Differences) or SSE (Sum of Squared Errors) and is used for determining whether to apply the bi-directional optical flow;generating a prediction block of the target block from the first and second reference pictures, by selectively either applying or skipping the bi-directional optical flow depending on the variable; andencoding partition information related to the tree structure, and residual signals that are differences between samples in the target block and samples in the prediction block,wherein the bi-directional optical flow is performed by the unit of samples in the target block or by the unit of sub-blocks partitioned from the target block.