Bug 1907121 - Return error for non-I444 Identity color space in ConvertYCbCrToRGB32 r=gfx-reviewers,nical
The ConvertYCbCrToRGB32 function in yuv_convert.cpp used to assert that the YUV format for the identity color space must be `I444`. Instead of asserting this, this patch returns an error in such cases. With recent changes, assertions will be maintained in most places except in `ConvertToRGBA` in ImageConversion.cpp. As a result, calling VideoFrame's `copyTo` with I420 format and a `rgb` colorspace matrix will no longer cause a crash. Differential Revision: https://phabricator.services.mozilla.com/D216192
This commit is contained in:
@@ -138,11 +138,12 @@ ConvertYCbCrToRGB32(const uint8_t* y_buf,
|
||||
: swap_uv? &libyuv::kYvuF709Constants : &libyuv::kYuvF709Constants;
|
||||
break;
|
||||
case YUVColorSpace::Identity:
|
||||
MOZ_ASSERT(yuv_type == YV24, "Identity (aka RGB) with chroma subsampling is unsupported");
|
||||
if (yuv_type == YV24) {
|
||||
break;
|
||||
}
|
||||
[[fallthrough]]; // Assuming BT601 for unsupported input is better than crashing
|
||||
NS_WARNING("Identity (aka RGB) with chroma subsampling is unsupported");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
// TODO: Consider using BT601 for unsupported input?
|
||||
default:
|
||||
MOZ_FALLTHROUGH_ASSERT("Unsupported YUVColorSpace");
|
||||
case YUVColorSpace::BT601:
|
||||
|
||||
Reference in New Issue
Block a user