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

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

Issue 839523002: V4L2VDA: Generalize EGLImage import and query driver for output formats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« media/base/video_frame.cc ('K') | « media/base/video_frame.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 (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/skcanvas_video_renderer.h" 5 #include "media/filters/skcanvas_video_renderer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/video_frame.h" 8 #include "media/base/video_frame.h"
9 #include "media/base/yuv_convert.h" 9 #include "media/base/yuv_convert.h"
10 #include "third_party/libyuv/include/libyuv.h" 10 #include "third_party/libyuv/include/libyuv.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 case VideoFrame::YV12A: 45 case VideoFrame::YV12A:
46 case VideoFrame::YV12J: 46 case VideoFrame::YV12J:
47 case VideoFrame::YV24: 47 case VideoFrame::YV24:
48 case VideoFrame::NV12: 48 case VideoFrame::NV12:
49 return true; 49 return true;
50 case VideoFrame::UNKNOWN: 50 case VideoFrame::UNKNOWN:
51 case VideoFrame::NATIVE_TEXTURE: 51 case VideoFrame::NATIVE_TEXTURE:
52 #if defined(VIDEO_HOLE) 52 #if defined(VIDEO_HOLE)
53 case VideoFrame::HOLE: 53 case VideoFrame::HOLE:
54 #endif // defined(VIDEO_HOLE) 54 #endif // defined(VIDEO_HOLE)
55 case VideoFrame::ARGB:
55 return false; 56 return false;
56 } 57 }
57 NOTREACHED() << "Invalid videoframe format provided: " << format; 58 NOTREACHED() << "Invalid videoframe format provided: " << format;
58 return false; 59 return false;
59 } 60 }
60 61
61 bool IsJPEGColorSpace(media::VideoFrame::Format format) { 62 bool IsJPEGColorSpace(media::VideoFrame::Format format) {
62 switch (format) { 63 switch (format) {
63 case VideoFrame::YV12J: 64 case VideoFrame::YV12J:
64 return true; 65 return true;
65 case VideoFrame::YV12: 66 case VideoFrame::YV12:
66 case VideoFrame::YV16: 67 case VideoFrame::YV16:
67 case VideoFrame::I420: 68 case VideoFrame::I420:
68 case VideoFrame::YV12A: 69 case VideoFrame::YV12A:
69 case VideoFrame::YV24: 70 case VideoFrame::YV24:
70 case VideoFrame::NV12: 71 case VideoFrame::NV12:
71 case VideoFrame::UNKNOWN: 72 case VideoFrame::UNKNOWN:
72 case VideoFrame::NATIVE_TEXTURE: 73 case VideoFrame::NATIVE_TEXTURE:
73 #if defined(VIDEO_HOLE) 74 #if defined(VIDEO_HOLE)
74 case VideoFrame::HOLE: 75 case VideoFrame::HOLE:
75 #endif // defined(VIDEO_HOLE) 76 #endif // defined(VIDEO_HOLE)
77 case VideoFrame::ARGB:
76 return false; 78 return false;
77 } 79 }
78 NOTREACHED() << "Invalid videoframe format provided: " << format; 80 NOTREACHED() << "Invalid videoframe format provided: " << format;
79 return false; 81 return false;
80 } 82 }
81 83
82 bool IsYUVOrNative(media::VideoFrame::Format format) { 84 bool IsYUVOrNative(media::VideoFrame::Format format) {
83 return IsYUV(format) || format == media::VideoFrame::NATIVE_TEXTURE; 85 return IsYUV(format) || format == media::VideoFrame::NATIVE_TEXTURE;
84 } 86 }
85 87
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 libyuv::ARGBToABGR(static_cast<uint8*>(rgb_pixels), 193 libyuv::ARGBToABGR(static_cast<uint8*>(rgb_pixels),
192 row_bytes, 194 row_bytes,
193 static_cast<uint8*>(rgb_pixels), 195 static_cast<uint8*>(rgb_pixels),
194 row_bytes, 196 row_bytes,
195 video_frame->visible_rect().width(), 197 video_frame->visible_rect().width(),
196 video_frame->visible_rect().height()); 198 video_frame->visible_rect().height());
197 #endif 199 #endif
198 break; 200 break;
199 201
200 case media::VideoFrame::NATIVE_TEXTURE: { 202 case media::VideoFrame::NATIVE_TEXTURE: {
201 DCHECK_EQ(video_frame->format(), media::VideoFrame::NATIVE_TEXTURE);
202 SkBitmap tmp; 203 SkBitmap tmp;
203 tmp.installPixels( 204 tmp.installPixels(
204 SkImageInfo::MakeN32Premul(video_frame->visible_rect().width(), 205 SkImageInfo::MakeN32Premul(video_frame->visible_rect().width(),
205 video_frame->visible_rect().height()), 206 video_frame->visible_rect().height()),
206 rgb_pixels, 207 rgb_pixels,
207 row_bytes); 208 row_bytes);
208 video_frame->ReadPixelsFromNativeTexture(tmp); 209 video_frame->ReadPixelsFromNativeTexture(tmp);
209 break; 210 break;
210 } 211 }
212
213 case media::VideoFrame::ARGB:
211 default: 214 default:
212 NOTREACHED(); 215 NOTREACHED();
213 break; 216 break;
214 } 217 }
215 } 218 }
216 219
217 } // anonymous namespace 220 } // anonymous namespace
218 221
219 // Generates an RGB image from a VideoFrame. Convert YUV to RGB plain on GPU. 222 // Generates an RGB image from a VideoFrame. Convert YUV to RGB plain on GPU.
220 class VideoImageGenerator : public SkImageGenerator { 223 class VideoImageGenerator : public SkImageGenerator {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 last_frame_timestamp_ = media::kNoTimestamp(); 456 last_frame_timestamp_ = media::kNoTimestamp();
454 } 457 }
455 458
456 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() { 459 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() {
457 accelerated_last_frame_.reset(); 460 accelerated_last_frame_.reset();
458 accelerated_generator_ = nullptr; 461 accelerated_generator_ = nullptr;
459 accelerated_last_frame_timestamp_ = media::kNoTimestamp(); 462 accelerated_last_frame_timestamp_ = media::kNoTimestamp();
460 } 463 }
461 464
462 } // namespace media 465 } // namespace media
OLDNEW
« media/base/video_frame.cc ('K') | « media/base/video_frame.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698