Bad quality with DIVX and DVD, H264 (mkv) works fine

I have installed latest KODI 16.1 from Google Play Store on my UHD TV Philips 43PUS6501.
Playing H264 movies (mkv) from my NAS works great, but when I play DVD or DIVX (avi) the image quality is poor.
Is there a solution to improve this?