Technically speaking, you can supply any planar YUV data with any
subsampling configuration to the compressor by using the
jpeg_write_raw_data() function in the libjpeg API, but that function is
not particularly user-friendly. The TurboJPEG API provides a much
friendlier way to do that, using the tjCompressFromYUV() function (API
documentation is here:
https://libjpeg-turbo.org/Documentation/Documentation). It will handle
4:4:4, 4:2:2, 4:2:0, grayscale, 4:4:0, and 4:1:1. libjpeg-turbo, in
general, does not handle packed YUV formats. It only handles planar
formats because that's what JPEG uses under the hood.
This is the appropriate forum for this question, because in the case of
libjpeg-turbo, "users" are developers. libjpeg-turbo-devel is used for
questions pertaining to the development of libjpeg-turbo itself.