summaryrefslogtreecommitdiffstats
path: root/media/base/video_util.h
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-20 23:09:56 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-20 23:09:56 +0000
commitb2579c047080258aecf3cfcfc15c750590f25187 (patch)
tree10900e71ada6b371b1e4c1d37be45ab7f21b2a6c /media/base/video_util.h
parent992e454546e7592443c1967c3e5b9262420f2ae0 (diff)
downloadchromium_src-b2579c047080258aecf3cfcfc15c750590f25187.zip
chromium_src-b2579c047080258aecf3cfcfc15c750590f25187.tar.gz
chromium_src-b2579c047080258aecf3cfcfc15c750590f25187.tar.bz2
Deduplicate YUV copying code, update call sites, and add some unit tests.
Historically such code is a source of out-of-bound reads/writes. TEST=media_unittests Review URL: http://codereview.chromium.org/7452009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/video_util.h')
-rw-r--r--media/base/video_util.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/media/base/video_util.h b/media/base/video_util.h
new file mode 100644
index 0000000..fa40984
--- /dev/null
+++ b/media/base/video_util.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_BASE_VIDEO_UTIL_H_
+#define MEDIA_BASE_VIDEO_UTIL_H_
+
+#include "base/basictypes.h"
+
+namespace media {
+
+class VideoFrame;
+
+// Copies a plane of YUV source into a VideoFrame object, taking into account
+// source and destinations dimensions.
+//
+// NOTE: rows is *not* the same as height!
+void CopyYPlane(const uint8* source, int stride, int rows, VideoFrame* frame);
+void CopyUPlane(const uint8* source, int stride, int rows, VideoFrame* frame);
+void CopyVPlane(const uint8* source, int stride, int rows, VideoFrame* frame);
+
+} // namespace media
+
+#endif // MEDIA_BASE_VIDEO_UTIL_H_