Copy buf to JPEG and copy JPEG to buf

I'm trying to convert a YUV 4:2:2 Color space JPEG
to YUV 4:1:1 Color space JPEG in memory without
having to write anything to disk.  The end result should
be a new JPEG contained in a pchar of some length.

My initial approach was to copy data pointed to by a pchar of isize
representing the 4:2:2 JPEG into a TMemoryStream then  passing that to a

TJPEGImage via LoadFromSstream.  Then, I'd like to change some
attributes, quality etc ... and finally using SaveToStream to copy back
to a buffer of some new length.

This approach seems straight forward but somehow, my
implementation is problematic: The destination buffer points to
null. I've probably been staring at it too long.

Does anyone suggestons?.