Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2023-02-27 12:15:12 +08:00
commit 7c0ddca067
280 changed files with 111730 additions and 37706 deletions

View file

@ -207,6 +207,7 @@ bool VideoData::SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
data.mPicSize = aPicture.Size();
data.mStereoMode = aInfo.mStereoMode;
data.mYUVColorSpace = aBuffer.mYUVColorSpace;
data.mColorRange = aBuffer.mColorRange;
aVideoImage->SetDelayedConversion(true);
if (aCopyData) {

View file

@ -449,6 +449,7 @@ public:
Plane mPlanes[3];
YUVColorSpace mYUVColorSpace = YUVColorSpace::BT601;
ColorRange mColorRange = ColorRange::LIMITED;
};
// Constructs a VideoData object. If aImage is nullptr, creates a new Image

View file

@ -391,7 +391,7 @@ nsresult VP8TrackEncoder::PrepareRawFrame(VideoChunk &aChunk)
switch (surf->GetFormat()) {
case SurfaceFormat::B8G8R8A8:
case SurfaceFormat::B8G8R8X8:
rv = libyuv::ARGBToI420(static_cast<uint8*>(map.GetData()),
rv = libyuv::ARGBToI420(static_cast<uint8_t*>(map.GetData()),
map.GetStride(),
y, mFrameWidth,
cb, halfWidth,
@ -399,7 +399,7 @@ nsresult VP8TrackEncoder::PrepareRawFrame(VideoChunk &aChunk)
mFrameWidth, mFrameHeight);
break;
case SurfaceFormat::R5G6B5_UINT16:
rv = libyuv::RGB565ToI420(static_cast<uint8*>(map.GetData()),
rv = libyuv::RGB565ToI420(static_cast<uint8_t*>(map.GetData()),
map.GetStride(),
y, mFrameWidth,
cb, halfWidth,

View file

@ -246,6 +246,8 @@ AOMDecoder::DoDecode(MediaRawData* aSample)
LOG("Unhandled colorspace %d", img->mc);
break;
}
b.mColorRange = img->range == AOM_CR_FULL_RANGE ? ColorRange::FULL
: ColorRange::LIMITED;
RefPtr<VideoData> v =
VideoData::CreateAndCopyData(mInfo,

View file

@ -173,6 +173,7 @@ VPXDecoder::DoDecode(MediaRawData* aSample)
return YUVColorSpace::BT601;
}
}();
// TODO: need a newer libvpx to support full color range
RefPtr<VideoData> v =
VideoData::CreateAndCopyData(mInfo,

View file

@ -154,6 +154,7 @@ FFmpegLibWrapper::Link()
AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
AV_FUNC_OPTION(av_frame_get_colorspace, AV_FUNC_AVUTIL_ALL)
AV_FUNC_OPTION(av_frame_get_color_range, AV_FUNC_AVUTIL_ALL)
#undef AV_FUNC
#undef AV_FUNC_OPTION

View file

@ -87,6 +87,7 @@ struct FFmpegLibWrapper
// libavutil optional
int (*av_frame_get_colorspace)(const AVFrame *frame);
int (*av_frame_get_color_range)(const AVFrame *frame);
PRLibrary* mAVCodecLib;
PRLibrary* mAVUtilLib;

View file

@ -388,6 +388,11 @@ FFmpegVideoDecoder<LIBAV_VER>::CreateImage(int64_t aOffset, int64_t aPts,
break;
}
}
if (mLib->av_frame_get_color_range) {
auto range = mLib->av_frame_get_color_range(mFrame);
b.mColorRange = range == AVCOL_RANGE_JPEG ? ColorRange::FULL : ColorRange::LIMITED;
}
RefPtr<VideoData> v =
VideoData::CreateAndCopyData(mInfo,
mImageContainer,