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

Side by Side Diff: media/gpu/v4l2_device.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: address Pawel's comments Created 4 years, 3 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/generic_v4l2_device.cc ('k') | media/gpu/v4l2_video_decode_accelerator.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 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 <libdrm/drm_fourcc.h> 5 #include <libdrm/drm_fourcc.h>
6 #include <linux/videodev2.h> 6 #include <linux/videodev2.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 case V4L2_PIX_FMT_NV12M: 44 case V4L2_PIX_FMT_NV12M:
45 return PIXEL_FORMAT_NV12; 45 return PIXEL_FORMAT_NV12;
46 46
47 case V4L2_PIX_FMT_MT21: 47 case V4L2_PIX_FMT_MT21:
48 return PIXEL_FORMAT_MT21; 48 return PIXEL_FORMAT_MT21;
49 49
50 case V4L2_PIX_FMT_YUV420: 50 case V4L2_PIX_FMT_YUV420:
51 case V4L2_PIX_FMT_YUV420M: 51 case V4L2_PIX_FMT_YUV420M:
52 return PIXEL_FORMAT_I420; 52 return PIXEL_FORMAT_I420;
53 53
54 case V4L2_PIX_FMT_YVU420:
55 return PIXEL_FORMAT_YV12;
56
54 case V4L2_PIX_FMT_RGB32: 57 case V4L2_PIX_FMT_RGB32:
55 return PIXEL_FORMAT_ARGB; 58 return PIXEL_FORMAT_ARGB;
56 59
57 default: 60 default:
58 LOG(FATAL) << "Add more cases as needed"; 61 LOG(FATAL) << "Add more cases as needed";
59 return PIXEL_FORMAT_UNKNOWN; 62 return PIXEL_FORMAT_UNKNOWN;
60 } 63 }
61 } 64 }
62 65
63 // static 66 // static
64 uint32_t V4L2Device::VideoPixelFormatToV4L2PixFmt(VideoPixelFormat format) { 67 uint32_t V4L2Device::VideoPixelFormatToV4L2PixFmt(VideoPixelFormat format) {
65 switch (format) { 68 switch (format) {
66 case PIXEL_FORMAT_NV12: 69 case PIXEL_FORMAT_NV12:
67 return V4L2_PIX_FMT_NV12M; 70 return V4L2_PIX_FMT_NV12M;
68 71
69 case PIXEL_FORMAT_MT21: 72 case PIXEL_FORMAT_MT21:
70 return V4L2_PIX_FMT_MT21; 73 return V4L2_PIX_FMT_MT21;
71 74
72 case PIXEL_FORMAT_I420: 75 case PIXEL_FORMAT_I420:
73 return V4L2_PIX_FMT_YUV420M; 76 return V4L2_PIX_FMT_YUV420M;
74 77
78 case PIXEL_FORMAT_YV12:
79 return V4L2_PIX_FMT_YVU420;
80
75 default: 81 default:
76 LOG(FATAL) << "Add more cases as needed"; 82 LOG(FATAL) << "Add more cases as needed";
77 return 0; 83 return 0;
78 } 84 }
79 } 85 }
80 86
81 // static 87 // static
82 uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, 88 uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile,
83 bool slice_based) { 89 bool slice_based) {
84 if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { 90 if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) {
(...skipping 18 matching lines...) Expand all
103 uint32_t V4L2Device::V4L2PixFmtToDrmFormat(uint32_t format) { 109 uint32_t V4L2Device::V4L2PixFmtToDrmFormat(uint32_t format) {
104 switch (format) { 110 switch (format) {
105 case V4L2_PIX_FMT_NV12: 111 case V4L2_PIX_FMT_NV12:
106 case V4L2_PIX_FMT_NV12M: 112 case V4L2_PIX_FMT_NV12M:
107 return DRM_FORMAT_NV12; 113 return DRM_FORMAT_NV12;
108 114
109 case V4L2_PIX_FMT_YUV420: 115 case V4L2_PIX_FMT_YUV420:
110 case V4L2_PIX_FMT_YUV420M: 116 case V4L2_PIX_FMT_YUV420M:
111 return DRM_FORMAT_YUV420; 117 return DRM_FORMAT_YUV420;
112 118
119 case V4L2_PIX_FMT_YVU420:
120 return DRM_FORMAT_YVU420;
121
113 case V4L2_PIX_FMT_RGB32: 122 case V4L2_PIX_FMT_RGB32:
114 return DRM_FORMAT_ARGB8888; 123 return DRM_FORMAT_ARGB8888;
115 124
116 default: 125 default:
117 DVLOG(1) << "Add more cases as needed"; 126 DVLOG(1) << "Add more cases as needed";
118 return 0; 127 return 0;
119 } 128 }
120 } 129 }
121 130
122 // static 131 // static
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 const auto iter = std::find_if( 315 const auto iter = std::find_if(
307 supported_profiles.begin(), supported_profiles.end(), 316 supported_profiles.begin(), supported_profiles.end(),
308 [profile](const VideoDecodeAccelerator::SupportedProfile& p) { 317 [profile](const VideoDecodeAccelerator::SupportedProfile& p) {
309 return profile == p.profile; 318 return profile == p.profile;
310 }); 319 });
311 320
312 return iter != supported_profiles.end(); 321 return iter != supported_profiles.end();
313 } 322 }
314 323
315 } // namespace media 324 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/generic_v4l2_device.cc ('k') | media/gpu/v4l2_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698