A method comprising: receiving a video; determining a content complexity of at least one block of pixels of a frame of the video based on a variation of the pixels in the block; determining an offset that varies according to the content complexity of the at least one block of pixels; determining a viewing characteristic of the video, wherein the viewing characteristic comprises at least an intended viewing distance between a viewer of the video and a display outputting the video and an intended ambient lighting level of a viewing setting of the video; determining a β threshold parameter based on the viewing characteristic, such that a higher β threshold parameter is selected for a video that is intended to be viewed at a larger viewing distance , wherein the β threshold parameter is further determined based on the offset, such that a higher β brtr threshold parameter is selected for a block showing a flat area ; determining a tc threshold parameter based on the viewing characteristic, such that a lower tc threshold parameter is selected for a video that is intended to be viewed at a lower ambient lighting level, wherein the tc threshold parameter is further determined based on the offset, such that a higher tc threshold parameter is selected for a block showing a flat area ; determining, based on the β threshold parameter, a number of borders of the at least one block of pixels to be filtered; determining, based on the tc threshold parameter, a deblocking filter strength; filtering, using the deblocking filter strength, the number of borders of the at least one block of pixels; and causing output of the filtered at least one block of pixels. receiving a video; determining a content complexity of at least one block of pixels of a frame of the video based on a variation of the pixels in the block; determining an offset that varies according to the content complexity of the at least one block of pixels; determining a viewing characteristic of the video, wherein the viewing characteristic comprises at least an intended viewing distance between a viewer of the video and a display outputting the video and an intended ambient lighting level of a viewing setting of the video; determining a β threshold parameter based on the viewing characteristic, such that a higher β threshold parameter is selected for a video that is intended to be viewed at a larger viewing distance , wherein the β threshold parameter is further determined based on the offset, such that a higher β brtr threshold parameter is selected for a block showing a flat area ; determining a tc threshold parameter based on the viewing characteristic, such that a lower tc threshold parameter is selected for a video that is intended to be viewed at a lower ambient lighting level, wherein the tc threshold parameter is further determined based on the offset, such that a higher tc threshold parameter is selected for a block showing a flat area ; determining, based on the β threshold parameter, a number of borders of the at least one block of pixels to be filtered; determining, based on the tc threshold parameter, a deblocking filter strength; filtering, using the deblocking filter strength, the number of borders of the at least one block of pixels; and causing output of the filtered at least one block of pixels. <EOS>