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

Side by Side Diff: media/gpu/v4l2_video_decode_accelerator.cc

Issue 2260123002: V4L2VDA: use YV12 as output format if processor supports it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/gpu/v4l2_device.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/gpu/v4l2_video_decode_accelerator.h" 5 #include "media/gpu/v4l2_video_decode_accelerator.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <linux/videodev2.h> 10 #include <linux/videodev2.h>
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 fmtdesc.pixelformat) != processor_input_formats.end()) { 2031 fmtdesc.pixelformat) != processor_input_formats.end()) {
2032 DVLOGF(1) << "Image processor input format=" << fmtdesc.pixelformat; 2032 DVLOGF(1) << "Image processor input format=" << fmtdesc.pixelformat;
2033 return fmtdesc.pixelformat; 2033 return fmtdesc.pixelformat;
2034 } 2034 }
2035 ++fmtdesc.index; 2035 ++fmtdesc.index;
2036 } 2036 }
2037 return 0; 2037 return 0;
2038 } 2038 }
2039 2039
2040 uint32_t V4L2VideoDecodeAccelerator::FindImageProcessorOutputFormat() { 2040 uint32_t V4L2VideoDecodeAccelerator::FindImageProcessorOutputFormat() {
2041 const uint32_t kPreferredEGLImageFormat = V4L2_PIX_FMT_YVU420;
2041 V4L2ImageProcessor image_processor(image_processor_device_); 2042 V4L2ImageProcessor image_processor(image_processor_device_);
2042 std::vector<uint32_t> processor_output_formats = 2043 std::vector<uint32_t> processor_output_formats =
2043 image_processor.GetSupportedOutputFormats(); 2044 image_processor.GetSupportedOutputFormats();
kcwu 2016/08/19 05:50:59 I'm wondering what if we simply push_front preferr
wuchengli 2016/08/19 06:01:42 Done. Good idea.
2045
2046 // Check the preferred format first.
2047 if (device_->CanCreateEGLImageFrom(kPreferredEGLImageFormat)) {
2048 std::vector<uint32_t>::iterator it =
2049 std::find(processor_output_formats.begin(),
2050 processor_output_formats.end(), kPreferredEGLImageFormat);
2051 if (it != processor_output_formats.end()) {
kcwu 2016/08/19 05:50:59 swap these two if-conditions at line 2051 and 2047
wuchengli 2016/08/19 06:01:42 The code is removed.
2052 DVLOGF(1) << "Image processor output format=" << kPreferredEGLImageFormat;
2053 return kPreferredEGLImageFormat;
2054 }
2055 }
2056
2044 for (uint32_t processor_output_format : processor_output_formats) { 2057 for (uint32_t processor_output_format : processor_output_formats) {
2045 if (device_->CanCreateEGLImageFrom(processor_output_format)) { 2058 if (device_->CanCreateEGLImageFrom(processor_output_format)) {
2046 DVLOGF(1) << "Image processor output format=" << processor_output_format; 2059 DVLOGF(1) << "Image processor output format=" << processor_output_format;
2047 return processor_output_format; 2060 return processor_output_format;
2048 } 2061 }
2049 } 2062 }
2050 2063
2051 return 0; 2064 return 0;
2052 } 2065 }
2053 2066
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 Enqueue(); 2284 Enqueue();
2272 } 2285 }
2273 } 2286 }
2274 2287
2275 void V4L2VideoDecodeAccelerator::ImageProcessorError() { 2288 void V4L2VideoDecodeAccelerator::ImageProcessorError() {
2276 LOGF(ERROR) << "Image processor error"; 2289 LOGF(ERROR) << "Image processor error";
2277 NOTIFY_ERROR(PLATFORM_FAILURE); 2290 NOTIFY_ERROR(PLATFORM_FAILURE);
2278 } 2291 }
2279 2292
2280 } // namespace media 2293 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/v4l2_device.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698