Allow YUVJ420 format.
FFMpeg H264 decoder uses YUVJ420 when video_full_range_flag=1 in bitstream. Information about color range might be useful for color converter and renderer. But currently there is no way to extract it from the wrapper. Bug: webrtc:8185 Change-Id: Ifd1113f0eee3d7b5906d0cefbc29b4a1061262f6 Reviewed-on: https://webrtc-review.googlesource.com/32000 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21246}
This commit is contained in:

committed by
Commit Bot

parent
a9e0924fa7
commit
fd731cb7d9
@ -32,7 +32,8 @@ namespace webrtc {
|
||||
|
||||
namespace {
|
||||
|
||||
const AVPixelFormat kPixelFormat = AV_PIX_FMT_YUV420P;
|
||||
const AVPixelFormat kPixelFormatDefault = AV_PIX_FMT_YUV420P;
|
||||
const AVPixelFormat kPixelFormatFullRange = AV_PIX_FMT_YUVJ420P;
|
||||
const size_t kYPlaneIndex = 0;
|
||||
const size_t kUPlaneIndex = 1;
|
||||
const size_t kVPlaneIndex = 2;
|
||||
@ -95,10 +96,13 @@ int H264DecoderImpl::AVGetBuffer2(
|
||||
H264DecoderImpl* decoder = static_cast<H264DecoderImpl*>(context->opaque);
|
||||
// DCHECK values set in |InitDecode|.
|
||||
RTC_DCHECK(decoder);
|
||||
RTC_DCHECK_EQ(context->pix_fmt, kPixelFormat);
|
||||
// Necessary capability to be allowed to provide our own buffers.
|
||||
RTC_DCHECK(context->codec->capabilities | AV_CODEC_CAP_DR1);
|
||||
|
||||
// Limited or full range YUV420 is expected.
|
||||
RTC_CHECK(context->pix_fmt == kPixelFormatDefault ||
|
||||
context->pix_fmt == kPixelFormatFullRange);
|
||||
|
||||
// |av_frame->width| and |av_frame->height| are set by FFmpeg. These are the
|
||||
// actual image's dimensions and may be different from |context->width| and
|
||||
// |context->coded_width| due to reordering.
|
||||
@ -225,7 +229,7 @@ int32_t H264DecoderImpl::InitDecode(const VideoCodec* codec_settings,
|
||||
av_context_->coded_width = codec_settings->width;
|
||||
av_context_->coded_height = codec_settings->height;
|
||||
}
|
||||
av_context_->pix_fmt = kPixelFormat;
|
||||
av_context_->pix_fmt = kPixelFormatDefault;
|
||||
av_context_->extradata = nullptr;
|
||||
av_context_->extradata_size = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user