Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

sample_vpp_drm convert yv12 to nv12

Yabo_W_
Beginner
1,179 Views

Hi all:

I had a test of sample_vpp_drm, which is Intel media SDK 1.10's sample. My output pixel format is nv12, and I think the order of U and V  is reversed.

first step: create a yv12 rawvideo with ffmpeg:

./ffmpeg -i /mnt/upload/MPEGTS/Earth_TR2_1080.ts -frames 500  -vcodec rawvideo -pix_fmt yuv420p -s 1920x1080 -an ./input_yv12.yuv

second step: 

convert input_yv12.yuv from yv12 to nv12:

sudo ./_bin/x64/sample_vpp_drm -lib hw -sw 1920 -sh 1080 -scc yv12 -spic 0 -dcc nv12 -dw 1920 -dh 1080 -i ./input_yv12.yuv -o ./output.yuv

finally:

play output.yuv with ffplay:

ffplay -pix_fmt nv12 output.yuv

nv12.png

the output's color is incorrect

but when I use nv21 pixer format, the output's color is correct:

ffplay -pix_fmt nv21 output.yuv

nv21.png

the input_yv12.yuv is like this:

ffplay -pix_fmt yuv420p -s 1920x1080 input_yv12.yuv

yv12.png

0 Kudos
2 Replies
Surbhi_M_Intel
Employee
1,179 Views

Hi Yabo, 

Can you please check again if the input this is generated is YV12 input. They YV12 format is quite same as YUV420p but the U and V data is reversed. If you don't have tool to check that, then you can use YUV tool kit available online to check. 
I think because of assuming the input to be YV12, the colors of output is reversed. Please let us know your findings

Thanks
-Surbhi

0 Kudos
Yabo_W_
Beginner
1,179 Views

Hi SURBHI

This is my fault.They YV12 format is quite same as YUV420p but the U and V data is reversed. Below is the explain of YUV420P and YV12

http://en.wikipedia.org/wiki/YUV#Y.27UV420p_.28and_Y.27V12_or_YV12.29_to_RGB888_conversion

Best regards!

Thanks!

0 Kudos
Reply