avfilter/pad: improve error check for w and h