Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: media/filters/ffmpeg_video_decoder.cc

Issue 591313008: Add support for Rec709 color space videos in software YUV convert path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add enum to mojom Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/skcanvas_video_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/ffmpeg_video_decoder.h" 5 #include "media/filters/ffmpeg_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context, 80 int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context,
81 AVFrame* frame, 81 AVFrame* frame,
82 int flags) { 82 int flags) {
83 // Don't use |codec_context_| here! With threaded decoding, 83 // Don't use |codec_context_| here! With threaded decoding,
84 // it will contain unsynchronized width/height/pix_fmt values, 84 // it will contain unsynchronized width/height/pix_fmt values,
85 // whereas |codec_context| contains the current threads's 85 // whereas |codec_context| contains the current threads's
86 // updated width/height/pix_fmt, which can change for adaptive 86 // updated width/height/pix_fmt, which can change for adaptive
87 // content. 87 // content.
88 VideoFrame::Format format = PixelFormatToVideoFormat(codec_context->pix_fmt); 88 VideoFrame::Format format = PixelFormatToVideoFormat(codec_context->pix_fmt);
89 if (format == VideoFrame::YV12 &&
90 codec_context->colorspace == AVCOL_SPC_BT709) {
91 format = VideoFrame::YV12HD;
92 }
93
89 if (format == VideoFrame::UNKNOWN) 94 if (format == VideoFrame::UNKNOWN)
90 return AVERROR(EINVAL); 95 return AVERROR(EINVAL);
91 DCHECK(format == VideoFrame::YV12 || format == VideoFrame::YV16 || 96 DCHECK(format == VideoFrame::YV12 || format == VideoFrame::YV16 ||
92 format == VideoFrame::YV12J || format == VideoFrame::YV24); 97 format == VideoFrame::YV12J || format == VideoFrame::YV24 ||
98 format == VideoFrame::YV12HD);
93 99
94 gfx::Size size(codec_context->width, codec_context->height); 100 gfx::Size size(codec_context->width, codec_context->height);
95 const int ret = av_image_check_size(size.width(), size.height(), 0, NULL); 101 const int ret = av_image_check_size(size.width(), size.height(), 0, NULL);
96 if (ret < 0) 102 if (ret < 0)
97 return ret; 103 return ret;
98 104
99 gfx::Size natural_size; 105 gfx::Size natural_size;
100 if (codec_context->sample_aspect_ratio.num > 0) { 106 if (codec_context->sample_aspect_ratio.num > 0) {
101 natural_size = GetNaturalSize(size, 107 natural_size = GetNaturalSize(size,
102 codec_context->sample_aspect_ratio.num, 108 codec_context->sample_aspect_ratio.num,
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 351 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
346 ReleaseFFmpegResources(); 352 ReleaseFFmpegResources();
347 return false; 353 return false;
348 } 354 }
349 355
350 av_frame_.reset(av_frame_alloc()); 356 av_frame_.reset(av_frame_alloc());
351 return true; 357 return true;
352 } 358 }
353 359
354 } // namespace media 360 } // namespace media
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/skcanvas_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698