Method and device for entropy encoding coefficient level, and method and device for entropy decoding coefficient level
Provided is a method of decoding coefficients included in image data, the method including determining a Rice parameter for a current coefficient, based on a base level of the current coefficient; parsing coefficient level information indicating a size of the current coefficient from a bitstream by using the determined Rice parameter; and identifying the size of the current coefficient by de-binarizing the coefficient level information by using the determined Rice parameter.
1. A method of entropy decoding a coefficient included in video data, the method comprising:
obtaining absolute values of coefficients of predetermined locations from among coefficients entropy decoded prior to a current coefficient;
determining a sum of the absolute values of the coefficients of the predetermined locations;
determining a Rice parameter, based on a difference between the sum of the absolute values and a base level;
parsing, from a bitstream, coefficient level information regarding an absolute value of the current coefficient; and
obtaining the absolute value of the current coefficient based on the coefficient level information and the determined Rice parameter,
wherein the coefficients of the predetermined locations include at least one of a first coefficient adjacent to a right side of the current coefficient, a second coefficient adjacent to a right side of the first coefficient, a third coefficient adjacent to a lower side of the current coefficient, a fourth coefficient adjacent to a lower side of the third coefficient, or a fifth coefficient adjacent in the lower right diagonal direction of the current coefficient,
wherein the base level is determined based on whether the coefficient level information is absolute remainder information or absolute level information.
2. An apparatus for entropy encoding a coefficient included in video data, the apparatus comprising:
at least one processor; and
a memory,
wherein the memory stores at least one instruction configured to be executable by the at least one processor,
wherein the at least one instruction is configured to, when executed, cause the at least one processor to:
obtain coefficient level information regarding an absolute value of a current coefficient;
obtain absolute values of coefficients of predetermined locations from among coefficients entropy encoded prior to the current coefficient;
determining a sum of the absolute values of the coefficients of the predetermined locations;
determine a Rice parameter, based on a difference between the sum of the absolute values and a base level;
binarize the coefficient level information by using the determined Rice parameter; and
generate a bitstream including the binarized coefficient level information,
wherein the coefficients of the predetermined locations include at least one of a first coefficient adjacent to a right side of the current coefficient, a second coefficient adjacent to a right side of the first coefficient, a third coefficient adjacent to a lower side of the current coefficient, a fourth coefficient adjacent to a lower side of the third coefficient, or a fifth coefficient adjacent in the lower right diagonal direction of the current coefficient,
wherein the base level is determined based on whether the coefficient level information is absolute remainder information or absolute level information.