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

Unified Diff: webrtc/common_video/h264/pps_parser.cc

Issue 2728093002: Optimize ParseRbsp method in H264 bitstream parser. (Closed)
Patch Set: return vector to avoid copy Created 3 years, 10 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: webrtc/common_video/h264/pps_parser.cc
diff --git a/webrtc/common_video/h264/pps_parser.cc b/webrtc/common_video/h264/pps_parser.cc
index b2860c221fdbea48268539daabc3d9f6c95f0970..73ad0cd5689721b44f896bc38068e146d4b555c5 100644
--- a/webrtc/common_video/h264/pps_parser.cc
+++ b/webrtc/common_video/h264/pps_parser.cc
@@ -11,6 +11,7 @@
#include "webrtc/common_video/h264/pps_parser.h"
#include <memory>
+#include <vector>
#include "webrtc/common_video/h264/h264_common.h"
#include "webrtc/base/bitbuffer.h"
@@ -38,8 +39,8 @@ rtc::Optional<PpsParser::PpsState> PpsParser::ParsePps(const uint8_t* data,
// First, parse out rbsp, which is basically the source buffer minus emulation
// bytes (the last byte of a 0x00 0x00 0x03 sequence). RBSP is defined in
// section 7.3.1 of the H.264 standard.
- std::unique_ptr<rtc::Buffer> unpacked_buffer = H264::ParseRbsp(data, length);
- rtc::BitBuffer bit_buffer(unpacked_buffer->data(), unpacked_buffer->size());
+ std::vector<uint8_t> unpacked_buffer = H264::ParseRbsp(data, length);
+ rtc::BitBuffer bit_buffer(unpacked_buffer.data(), unpacked_buffer.size());
return ParseInternal(&bit_buffer);
}
@@ -52,15 +53,15 @@ bool PpsParser::ParsePpsIds(const uint8_t* data,
// First, parse out rbsp, which is basically the source buffer minus emulation
// bytes (the last byte of a 0x00 0x00 0x03 sequence). RBSP is defined in
// section 7.3.1 of the H.264 standard.
- std::unique_ptr<rtc::Buffer> unpacked_buffer = H264::ParseRbsp(data, length);
- rtc::BitBuffer bit_buffer(unpacked_buffer->data(), unpacked_buffer->size());
+ std::vector<uint8_t> unpacked_buffer = H264::ParseRbsp(data, length);
+ rtc::BitBuffer bit_buffer(unpacked_buffer.data(), unpacked_buffer.size());
return ParsePpsIdsInternal(&bit_buffer, pps_id, sps_id);
}
rtc::Optional<uint32_t> PpsParser::ParsePpsIdFromSlice(const uint8_t* data,
size_t length) {
- std::unique_ptr<rtc::Buffer> slice_rbsp(H264::ParseRbsp(data, length));
- rtc::BitBuffer slice_reader(slice_rbsp->data(), slice_rbsp->size());
+ std::vector<uint8_t> unpacked_buffer = H264::ParseRbsp(data, length);
+ rtc::BitBuffer slice_reader(unpacked_buffer.data(), unpacked_buffer.size());
uint32_t golomb_tmp;
// first_mb_in_slice: ue(v)

Powered by Google App Engine
This is Rietveld 408576698