Bug 1215089 - P1: Add YUV422 support to ffmpeg decoder. r=kentuckyfriedtakahe

This allows for VP9 profile 1 support.

MozReview-Commit-ID: KymoerXNyzA

--HG--
extra : rebase_source : 37bcf92e71a0e3b55d70e52e0e3b34d544f67631
This commit is contained in:
Jean-Yves Avenard 2017-06-29 23:07:03 +02:00
parent 50c9b712c0
commit 4bac0ed257

View File

@ -17,6 +17,7 @@
#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_NONE PIX_FMT_NONE
#endif
@ -48,6 +49,9 @@ ChoosePixelFormat(AVCodecContext* aCodecContext, const AVPixelFormat* 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;
@ -320,6 +324,9 @@ FFmpegVideoDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample,
if (mCodecContext->pix_fmt == AV_PIX_FMT_YUV444P) {
b.mPlanes[1].mWidth = b.mPlanes[2].mWidth = mFrame->width;
b.mPlanes[1].mHeight = b.mPlanes[2].mHeight = mFrame->height;
} else if (mCodecContext->pix_fmt == AV_PIX_FMT_YUV422P) {
b.mPlanes[1].mWidth = b.mPlanes[2].mWidth = (mFrame->width + 1) >> 1;
b.mPlanes[1].mHeight = b.mPlanes[2].mHeight = mFrame->height;
} 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;