VAAPI NV12 to RGBx bad luminance
I am getting bad luminance values when converting NV12 to RGBx using vaapipostproc. The results are even worse when converting RGBx to BGRx (I guess that there are two conversions because the driver is working with NV12 internally). If I change the yuv/rgb constants in intel-vaapi-driver:
https://github.com/intel/intel-vaapi-driver/blob/master/src/i965_yuv_coefs.c
to limited range RGB [16-235] I am getting correct results.
static const float yuv_to_rgb_bt601[] = { 1.0, 0, 1.402, 0, 1.0, -0.344, -0.714, -0.50196, 1.0, 1.772, 0, -0.50196, };
There is probably some additional incorrect scaling to range [0-255] that is causing the range clipping. I am still not sure if it is the i965 driver or gstreamer issue. It is working correctly on radeon with mesa drivers. Tested with:
gst-launch-1.0 filesrc location=Grayscale_Staircase-768x576.png ! pngdec ! videoconvert ! video/x-raw,format=NV12 ! vaapipostproc ! video/x-raw,format=BGRx ! videoconvert ! jpegenc ! filesink location=test.jpg
libva info: VA-API version 1.4.0 libva info: va_getDriverName() returns 0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_1_3 libva info: va_openDriver() returns 0 vainfo: VA-API version: 1.4 (libva 2.2.0) vainfo: Driver version: Intel i965 driver for Intel(R) Ivybridge Mobile - 2.4.0.pre1 (2.3.0-2-g72f10f1) vainfo: Supported profile and entrypoints VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Simple : VAEntrypointEncSlice VAProfileMPEG2Main : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointEncSlice VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice VAProfileH264Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointEncSlice VAProfileH264High : VAEntrypointVLD VAProfileH264High : VAEntrypointEncSlice VAProfileH264StereoHigh : VAEntrypointVLD VAProfileVC1Simple : VAEntrypointVLD VAProfileVC1Main : VAEntrypointVLD VAProfileVC1Advanced : VAEntrypointVLD VAProfileNone : VAEntrypointVideoProc VAProfileJPEGBaseline : VAEntrypointVLD