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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: media/base/video_util.h
diff --git a/media/base/video_util.h b/media/base/video_util.h
index 2dec7e9371013ff3bf0442cb798cef0c90104659..9c18cdcd169026ca45bd4a564b366777e512b80d 100644
--- a/media/base/video_util.h
+++ b/media/base/video_util.h
@@ -97,6 +97,25 @@ MEDIA_EXPORT void CopyRGBToVideoFrame(const uint8_t* source,
MEDIA_EXPORT scoped_refptr<VideoFrame> WrapAsI420VideoFrame(
const scoped_refptr<VideoFrame>& frame);
+// Copy I420 video frame to match the required coded size and pad the region
+// outside the visible rect repeatly with the last column / row up to the coded
+// size of |dst_frame|. Return false when |dst_frame| is empty or visible rect
+// is empty.
+// One application is content mirroring using HW encoder. As the required coded
+// size for encoder is unknown before capturing, memory copy is needed when the
+// coded size does not match the requirement. Padding can improve the encoding
+// efficiency in this case, as the encoder will encode the whole coded region.
+// Performance-wise, this function could be expensive as it does memory copy of
+// the whole visible rect.
+// Note:
+// 1. |src_frame| and |dst_frame| should have same size of visible rect.
+// 2. The visible rect's origin of |dst_frame| should be (0,0).
+// 3. |dst_frame|'s coded size (both width and height) should be larger than or
+// equal to the visible size, since the visible region in both frames should be
+// identical.
+MEDIA_EXPORT bool I420CopyWithPadding(const VideoFrame& src_frame,
+ VideoFrame* dst_frame) WARN_UNUSED_RESULT;
+
} // namespace media
#endif // MEDIA_BASE_VIDEO_UTIL_H_
« 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