mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-30 11:07:29 +09:00
Issue #2101 - Part 5: Add ColorRange support to video decoders
This commit is contained in:
parent
b5f9e9abb6
commit
e59e8c3b2c
5 changed files with 10 additions and 0 deletions
|
|
@ -246,6 +246,8 @@ AOMDecoder::DoDecode(MediaRawData* aSample)
|
||||||
LOG("Unhandled colorspace %d", img->mc);
|
LOG("Unhandled colorspace %d", img->mc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
b.mColorRange = img->range == AOM_CR_FULL_RANGE ? ColorRange::FULL
|
||||||
|
: ColorRange::LIMITED;
|
||||||
|
|
||||||
RefPtr<VideoData> v =
|
RefPtr<VideoData> v =
|
||||||
VideoData::CreateAndCopyData(mInfo,
|
VideoData::CreateAndCopyData(mInfo,
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,7 @@ VPXDecoder::DoDecode(MediaRawData* aSample)
|
||||||
return YUVColorSpace::BT601;
|
return YUVColorSpace::BT601;
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
|
// TODO: need a newer libvpx to support full color range
|
||||||
|
|
||||||
RefPtr<VideoData> v =
|
RefPtr<VideoData> v =
|
||||||
VideoData::CreateAndCopyData(mInfo,
|
VideoData::CreateAndCopyData(mInfo,
|
||||||
|
|
|
||||||
|
|
@ -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_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(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_colorspace, AV_FUNC_AVUTIL_ALL)
|
||||||
|
AV_FUNC_OPTION(av_frame_get_color_range, AV_FUNC_AVUTIL_ALL)
|
||||||
#undef AV_FUNC
|
#undef AV_FUNC
|
||||||
#undef AV_FUNC_OPTION
|
#undef AV_FUNC_OPTION
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ struct FFmpegLibWrapper
|
||||||
|
|
||||||
// libavutil optional
|
// libavutil optional
|
||||||
int (*av_frame_get_colorspace)(const AVFrame *frame);
|
int (*av_frame_get_colorspace)(const AVFrame *frame);
|
||||||
|
int (*av_frame_get_color_range)(const AVFrame *frame);
|
||||||
|
|
||||||
PRLibrary* mAVCodecLib;
|
PRLibrary* mAVCodecLib;
|
||||||
PRLibrary* mAVUtilLib;
|
PRLibrary* mAVUtilLib;
|
||||||
|
|
|
||||||
|
|
@ -381,6 +381,11 @@ FFmpegVideoDecoder<LIBAV_VER>::CreateImage(int64_t aOffset, int64_t aPts,
|
||||||
break;
|
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 =
|
RefPtr<VideoData> v =
|
||||||
VideoData::CreateAndCopyData(mInfo,
|
VideoData::CreateAndCopyData(mInfo,
|
||||||
mImageContainer,
|
mImageContainer,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue