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

Side by Side Diff: media/base/video_util.h

Issue 1913503002: Memory copy the VideoFrame to match the requirement for HW encoders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test and addressed Xiaohan's comments. Created 4 years, 7 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 (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 #ifndef MEDIA_BASE_VIDEO_UTIL_H_ 5 #ifndef MEDIA_BASE_VIDEO_UTIL_H_
6 #define MEDIA_BASE_VIDEO_UTIL_H_ 6 #define MEDIA_BASE_VIDEO_UTIL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Fills the regions outside |region_in_frame| with black. 90 // Fills the regions outside |region_in_frame| with black.
91 MEDIA_EXPORT void CopyRGBToVideoFrame(const uint8_t* source, 91 MEDIA_EXPORT void CopyRGBToVideoFrame(const uint8_t* source,
92 int stride, 92 int stride,
93 const gfx::Rect& region_in_frame, 93 const gfx::Rect& region_in_frame,
94 VideoFrame* frame); 94 VideoFrame* frame);
95 95
96 // Converts a frame with YV12A format into I420 by dropping alpha channel. 96 // Converts a frame with YV12A format into I420 by dropping alpha channel.
97 MEDIA_EXPORT scoped_refptr<VideoFrame> WrapAsI420VideoFrame( 97 MEDIA_EXPORT scoped_refptr<VideoFrame> WrapAsI420VideoFrame(
98 const scoped_refptr<VideoFrame>& frame); 98 const scoped_refptr<VideoFrame>& frame);
99 99
100 // Copy I420 video frame to match the required coded size and pad the region
101 // outside the visible rect repeatly with the last column / row up to the coded
102 // size of |dst_frame|. Return false when |dst_frame| is empty or visible rect
103 // is empty.
104 // One application is content mirroring using HW encoder. As the required coded
105 // size for encoder is unknown before capturing, memory copy is needed when the
106 // coded size does not match the requirement. Padding can improve the encoding
107 // efficiency in this case, as the encoder will encode the whole coded region.
108 // Performance-wise, this function could be expensive as it does memory copy of
109 // the whole visible rect.
110 // Note:
111 // 1. |src_frame| and |dst_frame| should have same size of visible rect.
112 // 2. The visible rect's origin of |dst_frame| should be (0,0).
113 // 3. |dst_frame|'s coded size (both width and height) should be larger than or
114 // equal to the visible size, since the visible region in both frames should be
115 // identical.
116 MEDIA_EXPORT bool I420CopyWithPadding(const VideoFrame& src_frame,
117 VideoFrame* dst_frame) WARN_UNUSED_RESULT;
118
100 } // namespace media 119 } // namespace media
101 120
102 #endif // MEDIA_BASE_VIDEO_UTIL_H_ 121 #endif // MEDIA_BASE_VIDEO_UTIL_H_
OLDNEW
« no previous file with comments | « media/base/BUILD.gn ('k') | media/base/video_util.cc » ('j') | media/base/video_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698