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

Side by Side Diff: webrtc/common_video/h264/h264_common.h

Issue 2728093002: Optimize ParseRbsp method in H264 bitstream parser. (Closed)
Patch Set: return vector to avoid copy Created 3 years, 9 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 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // 00 00 01 -> 00 00 03 01 69 // 00 00 01 -> 00 00 03 01
70 // 00 00 02 -> 00 00 03 02 70 // 00 00 02 -> 00 00 03 02
71 // And things in the source that look like the emulation byte pattern (00 00 03) 71 // And things in the source that look like the emulation byte pattern (00 00 03)
72 // need to have an extra emulation byte added, so it's removed when decoding: 72 // need to have an extra emulation byte added, so it's removed when decoding:
73 // 00 00 03 -> 00 00 03 03 73 // 00 00 03 -> 00 00 03 03
74 // 74 //
75 // Decoding is simply a matter of finding any 00 00 03 sequence and removing 75 // Decoding is simply a matter of finding any 00 00 03 sequence and removing
76 // the 03 emulation byte. 76 // the 03 emulation byte.
77 77
78 // Parse the given data and remove any emulation byte escaping. 78 // Parse the given data and remove any emulation byte escaping.
79 std::unique_ptr<rtc::Buffer> ParseRbsp(const uint8_t* data, size_t length); 79 std::vector<uint8_t> ParseRbsp(const uint8_t* data, size_t length);
80 80
81 // Write the given data to the destination buffer, inserting and emulation 81 // Write the given data to the destination buffer, inserting and emulation
82 // bytes in order to escape any data the could be interpreted as a start 82 // bytes in order to escape any data the could be interpreted as a start
83 // sequence. 83 // sequence.
84 void WriteRbsp(const uint8_t* bytes, size_t length, rtc::Buffer* destination); 84 void WriteRbsp(const uint8_t* bytes, size_t length, rtc::Buffer* destination);
85 } // namespace H264 85 } // namespace H264
86 } // namespace webrtc 86 } // namespace webrtc
87 87
88 #endif // WEBRTC_COMMON_VIDEO_H264_H264_COMMON_H_ 88 #endif // WEBRTC_COMMON_VIDEO_H264_H264_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698