avcodec/pngdec: split P frames handling to a separate function.