How to convert raw8 to yuv420 on jetson xavier

I want to encode jpeg.
tegra_multimedia_api/samples/05_jpeg_encode can encode jpeg from yuv420.
can give addvice convert raw8 to yuv420 ?

For raw8, do you mean gray?

sorry forget to explain raw8.
It is bayer rggb data in practice.
I want compress bayer rggb to jpg don’t through isp tunning.

What we support is Bayer sensor input going through ISP engine to have yuv420. Your usecase should not be supported. Please look for software solutions.

Thanks, I know.
Maybe I need use CUDA programming to have yuv420 just like tegra_multimedia_api/samples/v4l2cuda.
It changes form yuv to rgb in tegra_multimedia_api/samples/v4l2cud use CUDA program.