Refactoring: use memory_cptr for codec private storage/passing