зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1496222 - Add missing pixel format in FFmpeg decoder r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D7664 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
bf9a555beb
Коммит
be4b99eff2
|
@ -17,9 +17,10 @@
|
|||
#define AVPixelFormat PixelFormat
|
||||
#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
|
||||
#define AV_PIX_FMT_YUVJ420P PIX_FMT_YUVJ420P
|
||||
#define AV_PIX_FMT_YUV422P PIX_FMT_YUV422P
|
||||
#define AV_PIX_FMT_YUV444P PIX_FMT_YUV444P
|
||||
#define AV_PIX_FMT_YUV420P10LE PIX_FMT_YUV420P10LE
|
||||
#define AV_PIX_FMT_YUV422P PIX_FMT_YUV422P
|
||||
#define AV_PIX_FMT_YUV422P10LE PIX_FMT_YUV422P10LE
|
||||
#define AV_PIX_FMT_YUV444P PIX_FMT_YUV444P
|
||||
#define AV_PIX_FMT_YUV444P10LE PIX_FMT_YUV444P10LE
|
||||
#define AV_PIX_FMT_NONE PIX_FMT_NONE
|
||||
#endif
|
||||
|
@ -48,12 +49,6 @@ ChoosePixelFormat(AVCodecContext* aCodecContext, const AVPixelFormat* aFormats)
|
|||
FFMPEG_LOG("Choosing FFmpeg pixel format for video decoding.");
|
||||
for (; *aFormats > -1; aFormats++) {
|
||||
switch (*aFormats) {
|
||||
case AV_PIX_FMT_YUV444P:
|
||||
FFMPEG_LOG("Requesting pixel format YUV444P.");
|
||||
return AV_PIX_FMT_YUV444P;
|
||||
case AV_PIX_FMT_YUV422P:
|
||||
FFMPEG_LOG("Requesting pixel format YUV422P.");
|
||||
return AV_PIX_FMT_YUV422P;
|
||||
case AV_PIX_FMT_YUV420P:
|
||||
FFMPEG_LOG("Requesting pixel format YUV420P.");
|
||||
return AV_PIX_FMT_YUV420P;
|
||||
|
@ -63,10 +58,25 @@ ChoosePixelFormat(AVCodecContext* aCodecContext, const AVPixelFormat* aFormats)
|
|||
case AV_PIX_FMT_YUV420P10LE:
|
||||
FFMPEG_LOG("Requesting pixel format YUV420P10LE.");
|
||||
return AV_PIX_FMT_YUV420P10LE;
|
||||
case AV_PIX_FMT_YUV422P:
|
||||
FFMPEG_LOG("Requesting pixel format YUV422P.");
|
||||
return AV_PIX_FMT_YUV422P;
|
||||
case AV_PIX_FMT_YUV422P10LE:
|
||||
FFMPEG_LOG("Requesting pixel format YUV422P10LE.");
|
||||
return AV_PIX_FMT_YUV422P10LE;
|
||||
case AV_PIX_FMT_YUV444P:
|
||||
FFMPEG_LOG("Requesting pixel format YUV444P.");
|
||||
return AV_PIX_FMT_YUV444P;
|
||||
case AV_PIX_FMT_YUV444P10LE:
|
||||
FFMPEG_LOG("Requesting pixel format YUV444P10LE.");
|
||||
return AV_PIX_FMT_YUV444P10LE;
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 57
|
||||
case AV_PIX_FMT_YUV420P12LE:
|
||||
FFMPEG_LOG("Requesting pixel format YUV420P12LE.");
|
||||
return AV_PIX_FMT_YUV420P12LE;
|
||||
case AV_PIX_FMT_YUV422P12LE:
|
||||
FFMPEG_LOG("Requesting pixel format YUV422P12LE.");
|
||||
return AV_PIX_FMT_YUV422P12LE;
|
||||
case AV_PIX_FMT_YUV444P12LE:
|
||||
FFMPEG_LOG("Requesting pixel format YUV444P12LE.");
|
||||
return AV_PIX_FMT_YUV444P12LE;
|
||||
|
@ -275,8 +285,7 @@ FFmpegVideoDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample,
|
|||
if (mCodecContext->pix_fmt == AV_PIX_FMT_YUV444P ||
|
||||
mCodecContext->pix_fmt == AV_PIX_FMT_YUV444P10LE
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 57
|
||||
||
|
||||
mCodecContext->pix_fmt == AV_PIX_FMT_YUV444P12LE
|
||||
|| mCodecContext->pix_fmt == AV_PIX_FMT_YUV444P12LE
|
||||
#endif
|
||||
) {
|
||||
b.mPlanes[1].mWidth = b.mPlanes[2].mWidth = mFrame->width;
|
||||
|
@ -289,15 +298,33 @@ FFmpegVideoDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample,
|
|||
b.mColorDepth = gfx::ColorDepth::COLOR_12;
|
||||
}
|
||||
#endif
|
||||
} else if (mCodecContext->pix_fmt == AV_PIX_FMT_YUV422P) {
|
||||
} else if (mCodecContext->pix_fmt == AV_PIX_FMT_YUV422P ||
|
||||
mCodecContext->pix_fmt == AV_PIX_FMT_YUV422P10LE
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 57
|
||||
|| mCodecContext->pix_fmt == AV_PIX_FMT_YUV422P12LE
|
||||
#endif
|
||||
) {
|
||||
b.mPlanes[1].mWidth = b.mPlanes[2].mWidth = (mFrame->width + 1) >> 1;
|
||||
b.mPlanes[1].mHeight = b.mPlanes[2].mHeight = mFrame->height;
|
||||
if (mCodecContext->pix_fmt == AV_PIX_FMT_YUV422P10LE) {
|
||||
b.mColorDepth = gfx::ColorDepth::COLOR_10;
|
||||
}
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 57
|
||||
else if (mCodecContext->pix_fmt == AV_PIX_FMT_YUV422P12LE) {
|
||||
b.mColorDepth = gfx::ColorDepth::COLOR_12;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
b.mPlanes[1].mWidth = b.mPlanes[2].mWidth = (mFrame->width + 1) >> 1;
|
||||
b.mPlanes[1].mHeight = b.mPlanes[2].mHeight = (mFrame->height + 1) >> 1;
|
||||
if (mCodecContext->pix_fmt == AV_PIX_FMT_YUV420P10LE) {
|
||||
b.mColorDepth = gfx::ColorDepth::COLOR_10;
|
||||
}
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 57
|
||||
else if (mCodecContext->pix_fmt == AV_PIX_FMT_YUV420P12LE) {
|
||||
b.mColorDepth = gfx::ColorDepth::COLOR_12;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (mLib->av_frame_get_colorspace) {
|
||||
switch (mLib->av_frame_get_colorspace(mFrame)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче