avutil: Add av_image_check_size2()