Disclosed according to one exemplary embodiment includes not limited to: a filtering unit configured to generate filtering information by filtering a residual image corresponding to a difference between an original image and a prediction image; an inverse filtering unit configured to generate inverse filtering information by inversely filtering the filtering information; an estimator configured to generate the prediction image based on the original image and reconstruction information; a CNN-based in-loop filter configured to receive the inverse filtering information and the prediction image and to output the reconstruction information; and an encoder configured to perform encoding based on the filtering information and information of the prediction image, and wherein the CNN-based in-loop filter is trained for each of the plurality of artefact sections according to an artefact value or for each of the plurality of quantization parameter sections according to a quantization parameter.