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

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

Issue 289373011: Support for YUV 4:4:4 subsampling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Software path. Created 6 years, 7 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
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 AVFrame* frame) { 62 AVFrame* frame) {
63 // Don't use |codec_context_| here! With threaded decoding, 63 // Don't use |codec_context_| here! With threaded decoding,
64 // it will contain unsynchronized width/height/pix_fmt values, 64 // it will contain unsynchronized width/height/pix_fmt values,
65 // whereas |codec_context| contains the current threads's 65 // whereas |codec_context| contains the current threads's
66 // updated width/height/pix_fmt, which can change for adaptive 66 // updated width/height/pix_fmt, which can change for adaptive
67 // content. 67 // content.
68 VideoFrame::Format format = PixelFormatToVideoFormat(codec_context->pix_fmt); 68 VideoFrame::Format format = PixelFormatToVideoFormat(codec_context->pix_fmt);
69 if (format == VideoFrame::UNKNOWN) 69 if (format == VideoFrame::UNKNOWN)
70 return AVERROR(EINVAL); 70 return AVERROR(EINVAL);
71 DCHECK(format == VideoFrame::YV12 || format == VideoFrame::YV16 || 71 DCHECK(format == VideoFrame::YV12 || format == VideoFrame::YV16 ||
72 format == VideoFrame::YV12J); 72 format == VideoFrame::YV12J || format == VideoFrame::I444);
73 73
74 gfx::Size size(codec_context->width, codec_context->height); 74 gfx::Size size(codec_context->width, codec_context->height);
75 const int ret = av_image_check_size(size.width(), size.height(), 0, NULL); 75 const int ret = av_image_check_size(size.width(), size.height(), 0, NULL);
76 if (ret < 0) 76 if (ret < 0)
77 return ret; 77 return ret;
78 78
79 gfx::Size natural_size; 79 gfx::Size natural_size;
80 if (codec_context->sample_aspect_ratio.num > 0) { 80 if (codec_context->sample_aspect_ratio.num > 0) {
81 natural_size = GetNaturalSize(size, 81 natural_size = GetNaturalSize(size,
82 codec_context->sample_aspect_ratio.num, 82 codec_context->sample_aspect_ratio.num,
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 365 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
366 ReleaseFFmpegResources(); 366 ReleaseFFmpegResources();
367 return false; 367 return false;
368 } 368 }
369 369
370 av_frame_.reset(av_frame_alloc()); 370 av_frame_.reset(av_frame_alloc());
371 return true; 371 return true;
372 } 372 }
373 373
374 } // namespace media 374 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698