move memory functions from avcodec to avutil