Abnormal color problem when using nppiRGBToYCbCr444_JPEG api

“1. Original gif” extracted “2. rgba.raw” image.

When performing color conversion with “nppiRGBToYCbCr444_JPEG” using the source above, the color is slightly green “3. ycbcr444p_jpeg.raw”.

After analyzing this, we confirmed that converting it with host color conversion “rgb → ycbcr444” using the official Matrix “5.jpeg matrix” value of jpeg results in the same color as 3.

jpeg official matrix
y = ((0.299 * r) + (0.587 * g) + (0.114 * b));  
u = ((-0.1687 * r) - (0.3313 * g) + (0.5 * b) + 128);
v = ((0.5 * r) - (0.4187 * g) - (0.0813 * b) + 128);

On the other hand, we found that using a more precise Matrix “4.ffmpeg matrix” provided by ffmpeg, it is similar to the original rgb color.

ffmpeg matrix
y = ((0.299 * r) + (0.587 * g) + (0.114 * b) + 0.5);
u = ((-0.168736 * r) - (0.331264 * g) + (0.5 * b) + 128.5);
v = ((0.5 * r) - (0.418688 * g) - (0.081312 * b) + 128.5);

Therefore, we can estimate that the nvidia rgb to ycbcr jpeg matrix is ​​written in the official jpeg spec document.

The ffmpeg side matrix is ​​much closer to the original rgb gif image colors.
Is there a way NVIDIA can help with this situation?

The image used for that test. You can see it more clearly if you look at the original.
abnormal_color_6.zip (466.6 KB)