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.
3056 Discussions

Video scaling with "aspect ratio correction" (Letterbox or Pillarbox) results in incorrect color shift

Maximilian_W_
Beginner
292 Views

Hello there!

I ran in an problem, while scaling a video frame with Intels video processing library. This post should help anyone, who experiences same issue.

While  MFXVideoVPP::Init(mfxVideoParam *par) returns MFX_ERR_NONE, there is a color shift (yellow and blue are broken) in the output video data. This runtime error occures because of misconfiguration of "crop" parameters. 

In this example a NTSC frame is scaled to 640x480 frame, under "scale to height" aspect ratio correction  mode.
(To achive this i have to cut equal parts from the left and right sides of the source frame)

This configuration results in described "color-shift" error:

"Intel API Implementation: MFX_IMPL_SOFTWARE Version: 1.13"    
"-------VPP Parameter-------"    
"AsyncDepth: 0"    
"NumExtParam: 0"    
"IOPattern: MFX_IOPATTERN_IN_SYSTEM_MEMORY,MFX_IOPATTERN_OUT_SYSTEM_MEMORY"    
"-------VPP INPUT-------"    
"BitDepthLuma: 8"    
"BitDepthChroma: 8"    
"Shift: 0"    
"FourCC: YUY2"    
"Width: 720"    
"Height: 512"    
"CropX: 35"    
"CropY: 0"    
"CropW: 650"    
"CropH: 486"    
"FrameRateExtN: 30000"    
"FrameRateExtD: 1001"    
"AspectRatioW: 0"    
"AspectRatioH: 0"    
"PicStruct: MFX_PICSTRUCT_FIELD_BFF"    
"ChromaFormat: MFX_CHROMAFORMAT_YUV422"    
""    
"-------VPP OUTPUT-------"    
"BitDepthLuma: 8"    
"BitDepthChroma: 8"    
"Shift: 0"    
"FourCC: RGB4"    
"Width: 640"    
"Height: 480"    
"CropX: 0"    
"CropY: 0"    
"CropW: 640"    
"CropH: 480"    
"FrameRateExtN: 30000"    
"FrameRateExtD: 1001"    
"AspectRatioW: 0"    
"AspectRatioH: 0"    
"PicStruct: MFX_PICSTRUCT_PROGRESSIVE"    
"ChromaFormat: MFX_CHROMAFORMAT_YUV444"    

This would be the correct configuration :

"Intel API Implementation: MFX_IMPL_SOFTWARE Version: 1.13"    
"-------VPP Parameter-------"    
"AsyncDepth: 0"    
"NumExtParam: 0"    
"IOPattern: MFX_IOPATTERN_IN_SYSTEM_MEMORY,MFX_IOPATTERN_OUT_SYSTEM_MEMORY"    
"-------VPP INPUT-------"    
"BitDepthLuma: 8"    
"BitDepthChroma: 8"    
"Shift: 0"    
"FourCC: YUY2"    
"Width: 720"    
"Height: 512"    
"CropX: 36"    
"CropY: 0"    
"CropW: 648"    
"CropH: 486"    
"FrameRateExtN: 30000"    
"FrameRateExtD: 1001"    
"AspectRatioW: 0"    
"AspectRatioH: 0"    
"PicStruct: MFX_PICSTRUCT_FIELD_BFF"    
"ChromaFormat: MFX_CHROMAFORMAT_YUV422"    
""    
"-------VPP OUTPUT-------"    
"BitDepthLuma: 8"    
"BitDepthChroma: 8"    
"Shift: 0"    
"FourCC: RGB4"    
"Width: 640"    
"Height: 480"    
"CropX: 0"    
"CropY: 0"    
"CropW: 640"    
"CropH: 480"    
"FrameRateExtN: 30000"    
"FrameRateExtD: 1001"    
"AspectRatioW: 0"    
"AspectRatioH: 0"    
"PicStruct: MFX_PICSTRUCT_PROGRESSIVE"    
"ChromaFormat: MFX_CHROMAFORMAT_YUV444"    

 

Kind regards,
Max

 

0 Kudos
1 Reply
Sravanthi_K_Intel
292 Views

Thanks for the note Max - since you provided the solution already, I am going to close the thread. If there is any other question, please start a new thread.

0 Kudos
Reply