Bug 1543359 - P0. Make video range info an enum. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D29639

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2019-07-26 08:45:22 +00:00
Родитель 79b0c0cd82
Коммит e41290cb09
6 изменённых файлов: 23 добавлений и 5 удалений

Просмотреть файл

@ -251,7 +251,7 @@ class VideoInfo : public TrackInfo {
// True indicates no restriction on Y, U, V values (otherwise 16-235 for 8
// bits etc)
bool mFullRange = false;
gfx::ColorRange mColorRange = gfx::ColorRange::LIMITED;
private:
// mImage may be cropped; currently only used with the WebM container.

Просмотреть файл

@ -31,7 +31,7 @@ struct ParamTraits<mozilla::VideoInfo> {
WriteParam(aMsg, aParam.mRotation);
WriteParam(aMsg, aParam.mColorDepth);
WriteParam(aMsg, aParam.mColorSpace);
WriteParam(aMsg, aParam.mFullRange);
WriteParam(aMsg, aParam.mColorRange);
WriteParam(aMsg, aParam.HasAlpha());
}
@ -49,7 +49,7 @@ struct ParamTraits<mozilla::VideoInfo> {
ReadParam(aMsg, aIter, &aResult->mRotation) &&
ReadParam(aMsg, aIter, &aResult->mColorDepth) &&
ReadParam(aMsg, aIter, &aResult->mColorSpace) &&
ReadParam(aMsg, aIter, &aResult->mFullRange) &&
ReadParam(aMsg, aIter, &aResult->mColorRange) &&
ReadParam(aMsg, aIter, &alphaPresent)) {
aResult->SetImageRect(imageRect);
aResult->SetAlpha(alphaPresent);

Просмотреть файл

@ -111,6 +111,10 @@ class VPXDecoder : public MediaDataDecoder,
*/
bool mFullRange = false;
gfx::ColorRange ColorRange() const {
return mFullRange ? gfx::ColorRange::FULL : gfx::ColorRange::LIMITED;
}
/*
Sub-sampling, used only for non sRGB colorspace.
subsampling_x subsampling_y Description

Просмотреть файл

@ -141,7 +141,9 @@ class H264ChangeMonitor : public MediaChangeMonitor::CodecChangeMonitor {
gfx::IntRect(0, 0, spsdata.pic_width, spsdata.pic_height));
mCurrentConfig.mColorDepth = spsdata.ColorDepth();
mCurrentConfig.mColorSpace = spsdata.ColorSpace();
mCurrentConfig.mFullRange = spsdata.video_full_range_flag;
mCurrentConfig.mColorRange = spsdata.video_full_range_flag
? gfx::ColorRange::FULL
: gfx::ColorRange::LIMITED;
}
mCurrentConfig.mExtraData = aExtraData;
mTrackInfo = new TrackInfoSharedPtr(mCurrentConfig, mStreamID++);
@ -202,7 +204,7 @@ class VPXChangeMonitor : public MediaChangeMonitor::CodecChangeMonitor {
// The AR data isn't found in the VP8/VP9 bytestream.
mCurrentConfig.mColorDepth = gfx::ColorDepthForBitDepth(info.mBitDepth);
mCurrentConfig.mColorSpace = info.ColorSpace();
mCurrentConfig.mFullRange = info.mFullRange;
mCurrentConfig.mColorRange = info.ColorRange();
mTrackInfo = new TrackInfoSharedPtr(mCurrentConfig, mStreamID++);
return rv;

Просмотреть файл

@ -156,6 +156,12 @@ enum class ColorDepth : uint8_t {
UNKNOWN
};
enum class ColorRange : uint8_t {
LIMITED,
FULL,
UNKNOWN
};
static inline SurfaceFormat SurfaceFormatForColorDepth(ColorDepth aColorDepth) {
SurfaceFormat format = SurfaceFormat::A8;
switch (aColorDepth) {

Просмотреть файл

@ -652,6 +652,12 @@ struct ParamTraits<mozilla::gfx::ColorDepth>
mozilla::gfx::ColorDepth::COLOR_8,
mozilla::gfx::ColorDepth::UNKNOWN> {};
template <>
struct ParamTraits<mozilla::gfx::ColorRange>
: public ContiguousEnumSerializer<mozilla::gfx::ColorRange,
mozilla::gfx::ColorRange::LIMITED,
mozilla::gfx::ColorRange::UNKNOWN> {};
template <>
struct ParamTraits<mozilla::gfx::YUVColorSpace>
: public ContiguousEnumSerializer<