A method of encoding video data for a video encoding system, the method comprising: receiving input data including a current block of the video data, wherein the current block of the video data corresponds to a coding unit, CU,; determining a coding mode for the current block of video data, wherein the coding mode is selected from a set of coding modes including a palette coding mode; and if the palette coding mode is selected for the current block of the video data: mapping pixels in the current block of the video data to palette indices according to a palette table; determining a variable related to a total number of palette indices in the current block of the video data, wherein the variable represents the total number of palette indices in the current block of the video data or the total number of palette indices in the current block of the video data minus 1; determining a Rice parameter k for the current block of the video data; binarizing the variable into a binary string using a Truncated Rice, TR, binarization process with input information including the Rice parameter to generate a prefix part of the binary string and using a k-th order Exponential Golomb, EGk, binarization process to generate a suffix part of the binary string, or binarizing the variable into a binary string using the EGk binarization process with input information including the Rice parameter, wherein the suffix part is allowed to be empty and k is a non-negative integer; and including the binary string representing the variable in a bitstream for the video data; characterized in that the Rice parameter is determined using a log-base-2 function of the block size of the current block; and if the Rice parameter for the current block is larger than log-base-2 function of the block size of the current block, the Rice parameter for the current block is set to the log-base-2 function of the block size of the current block and the Rice parameter is used for the TR binarization process. receiving input data including a current block of the video data, wherein the current block of the video data corresponds to a coding unit, CU,; determining a coding mode for the current block of video data, wherein the coding mode is selected from a set of coding modes including a palette coding mode; and if the palette coding mode is selected for the current block of the video data: mapping pixels in the current block of the video data to palette indices according to a palette table; determining a variable related to a total number of palette indices in the current block of the video data, wherein the variable represents the total number of palette indices in the current block of the video data or the total number of palette indices in the current block of the video data minus 1; determining a Rice parameter k for the current block of the video data; binarizing the variable into a binary string using a Truncated Rice, TR, binarization process with input information including the Rice parameter to generate a prefix part of the binary string and using a k-th order Exponential Golomb, EGk, binarization process to generate a suffix part of the binary string, or binarizing the variable into a binary string using the EGk binarization process with input information including the Rice parameter, wherein the suffix part is allowed to be empty and k is a non-negative integer; and including the binary string representing the variable in a bitstream for the video data; mapping pixels in the current block of the video data to palette indices according to a palette table; determining a variable related to a total number of palette indices in the current block of the video data, wherein the variable represents the total number of palette indices in the current block of the video data or the total number of palette indices in the current block of the video data minus 1; determining a Rice parameter k for the current block of the video data; binarizing the variable into a binary string using a Truncated Rice, TR, binarization process with input information including the Rice parameter to generate a prefix part of the binary string and using a k-th order Exponential Golomb, EGk, binarization process to generate a suffix part of the binary string, or binarizing the variable into a binary string using the EGk binarization process with input information including the Rice parameter, wherein the suffix part is allowed to be empty and k is a non-negative integer; and including the binary string representing the variable in a bitstream for the video data; characterized in that the Rice parameter is determined using a log-base-2 function of the block size of the current block; and if the Rice parameter for the current block is larger than log-base-2 function of the block size of the current block, the Rice parameter for the current block is set to the log-base-2 function of the block size of the current block and the Rice parameter is used for the TR binarization process.