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

Side by Side Diff: media/capture/video/video_capture_utils.cc

Issue 2121043002: 16 bpp video stream capture, render and WebGL usage - Realsense R200 & SR300 support. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/capture/video/blob_utils.h" 5 #include "media/capture/video/video_capture_utils.h"
6 6
7 #include "base/big_endian.h"
7 #include "media/base/video_capture_types.h" 8 #include "media/base/video_capture_types.h"
8 #include "media/base/video_frame.h" 9 #include "media/base/video_frame.h"
9 #include "third_party/libyuv/include/libyuv.h" 10 #include "third_party/libyuv/include/libyuv.h"
10 #include "third_party/skia/include/core/SkImage.h" 11 #include "third_party/skia/include/core/SkImage.h"
11 #include "ui/gfx/codec/png_codec.h" 12 #include "ui/gfx/codec/png_codec.h"
12 13
14 #define FourCcMacro(f, o, u, r) \
15 static_cast<unsigned>((static_cast<unsigned>(f) << 0)) | \
16 (static_cast<unsigned>(o) << 8) | (static_cast<unsigned>(u) << 16) | \
17 (static_cast<unsigned>(r) << 24)
18
13 namespace media { 19 namespace media {
14 20
21 static const unsigned kFourCcZ16 = FourCcMacro('Z', '1', '6', ' ');
22 static const unsigned kFourCcINVZ = FourCcMacro('I', 'N', 'V', 'Z');
23 static const unsigned kFourCcY16 = FourCcMacro('Y', '1', '6', ' ');
24
15 mojom::BlobPtr Blobify(const uint8_t* buffer, 25 mojom::BlobPtr Blobify(const uint8_t* buffer,
16 const uint32_t bytesused, 26 const uint32_t bytesused,
17 const VideoCaptureFormat& capture_format) { 27 const VideoCaptureFormat& capture_format) {
18 DCHECK(buffer); 28 DCHECK(buffer);
19 DCHECK(bytesused); 29 DCHECK(bytesused);
20 DCHECK(capture_format.IsValid()); 30 DCHECK(capture_format.IsValid());
21 31
22 const VideoPixelFormat pixel_format = capture_format.pixel_format; 32 const VideoPixelFormat pixel_format = capture_format.pixel_format;
23 if (pixel_format == VideoPixelFormat::PIXEL_FORMAT_MJPEG) { 33 if (pixel_format == VideoPixelFormat::PIXEL_FORMAT_MJPEG) {
24 mojom::BlobPtr blob = mojom::Blob::New(); 34 mojom::BlobPtr blob = mojom::Blob::New();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 const bool result = gfx::PNGCodec::Encode( 69 const bool result = gfx::PNGCodec::Encode(
60 tmp_argb.get(), codec_color_format, frame_size, frame_size.width() * 4, 70 tmp_argb.get(), codec_color_format, frame_size, frame_size.width() * 4,
61 true /* discard_transparency */, std::vector<gfx::PNGCodec::Comment>(), 71 true /* discard_transparency */, std::vector<gfx::PNGCodec::Comment>(),
62 &blob->data); 72 &blob->data);
63 DCHECK(result); 73 DCHECK(result);
64 74
65 blob->mime_type = "image/png"; 75 blob->mime_type = "image/png";
66 return blob; 76 return blob;
67 } 77 }
68 78
79 bool IsY16FormatFourCc(unsigned four) {
80 return four == kFourCcZ16 || four == kFourCcINVZ || four == kFourCcY16;
81 }
82
69 } // namespace media 83 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/video_capture_utils.h ('k') | media/capture/video/win/sink_input_pin_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698