avcodec/imm4: Unreference previous frame on frame size change