A method to reduce visual artifacts, the method comprising: providing, by a computer, a first image with a first dynamic range; predicting, by a computer, using a predictor and the first image, a second image with a second dynamic range, wherein the second dynamic range is higher than the first dynamic range; calculating, by a computer, parameters for a debanding filter based on the predictor, wherein the calculating, by a computer, parameters for the debanding filter comprises: calculating, for at least one pixel of the second image, a weighted average of neighboring pixels (505, 510, 520, 525), wherein the neighboring pixels (505, 510, 520, 525) are in a vertical and/or horizontal direction to the at least one pixel, and wherein the neighboring pixels (505, 510, 520, 525) are not immediately adjacent to other neighboring pixels (505, 510, 520, 525) or to the at least one pixel, calculating a difference between the at least one pixel of the second image and all of the neighboring pixels (505, 510, 520, 525); if the difference is below or equal to a threshold value for all of the neighboring pixels (505, 510, 520, 525), applying, by a computer, the debanding filter to the at least one pixel to generate an output image with the second dynamic range, wherein the threshold value is calculated with Δ LUT b = t ⋅ max s k ≤ LUT b < s k + 1 | LUT b + 1 − LUT b | wherein LUT is a look up table to convert from the first image to the second image, LUT(b) is a codeword for the at least one pixel of the second image, b is a codeword for a pixel of the first image corresponding to the pixel of the second image, t is a numerical factor, and s k and s k+1 are pivot points. providing, by a computer, a first image with a first dynamic range; predicting, by a computer, using a predictor and the first image, a second image with a second dynamic range, wherein the second dynamic range is higher than the first dynamic range; calculating, by a computer, parameters for a debanding filter based on the predictor, wherein the calculating, by a computer, parameters for the debanding filter comprises: calculating, for at least one pixel of the second image, a weighted average of neighboring pixels (505, 510, 520, 525), wherein the neighboring pixels (505, 510, 520, 525) are in a vertical and/or horizontal direction to the at least one pixel, and wherein the neighboring pixels (505, 510, 520, 525) are not immediately adjacent to other neighboring pixels (505, 510, 520, 525) or to the at least one pixel, calculating a difference between the at least one pixel of the second image and all of the neighboring pixels (505, 510, 520, 525); if the difference is below or equal to a threshold value for all of the neighboring pixels (505, 510, 520, 525), applying, by a computer, the debanding filter to the at least one pixel to generate an output image with the second dynamic range, wherein the threshold value is calculated with Δ LUT b = t ⋅ max s k ≤ LUT b < s k + 1 | LUT b + 1 − LUT b | wherein LUT is a look up table to convert from the first image to the second image, LUT(b) is a codeword for the at least one pixel of the second image, b is a codeword for a pixel of the first image corresponding to the pixel of the second image, t is a numerical factor, and s k and s k+1 are pivot points. calculating, for at least one pixel of the second image, a weighted average of neighboring pixels (505, 510, 520, 525), wherein the neighboring pixels (505, 510, 520, 525) are in a vertical and/or horizontal direction to the at least one pixel, and wherein the neighboring pixels (505, 510, 520, 525) are not immediately adjacent to other neighboring pixels (505, 510, 520, 525) or to the at least one pixel, calculating a difference between the at least one pixel of the second image and all of the neighboring pixels (505, 510, 520, 525); if the difference is below or equal to a threshold value for all of the neighboring pixels (505, 510, 520, 525), applying, by a computer, the debanding filter to the at least one pixel to generate an output image with the second dynamic range, wherein the threshold value is calculated with Δ LUT b = t ⋅ max s k ≤ LUT b < s k + 1 | LUT b + 1 − LUT b | wherein LUT is a look up table to convert from the first image to the second image, LUT(b) is a codeword for the at least one pixel of the second image, b is a codeword for a pixel of the first image corresponding to the pixel of the second image, t is a numerical factor, and s k and s k+1 are pivot points.