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

Unified Diff: webrtc/modules/video_coding/utility/h264_bitstream_parser_unittest.cc

Issue 2373393002: Support for parsing CABAC coded bitstreams (Closed)
Patch Set: Add support for CABAC in bitstream parser Created 4 years, 3 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/modules/video_coding/utility/h264_bitstream_parser_unittest.cc
diff --git a/webrtc/modules/video_coding/utility/h264_bitstream_parser_unittest.cc b/webrtc/modules/video_coding/utility/h264_bitstream_parser_unittest.cc
index ebc44675444d535dceeab9af09c6d9296b25296a..7de6766c0d5a59cffccd81011f6985bbfb0bcc6b 100644
--- a/webrtc/modules/video_coding/utility/h264_bitstream_parser_unittest.cc
+++ b/webrtc/modules/video_coding/utility/h264_bitstream_parser_unittest.cc
@@ -32,6 +32,18 @@ uint8_t kH264BitstreamNextImageSliceChunk[] = {
0x00, 0x00, 0x00, 0x01, 0x41, 0xe2, 0x01, 0x16, 0x0e, 0x3e, 0x2b, 0x86,
};
+uint8_t kH264BitstreamChunkCABAC[] = {
stefan-webrtc 2016/09/30 13:33:09 s/CABAC/Cabac/
+ 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x20, 0xda, 0x01, 0x40, 0x16,
+ 0xe8, 0x06, 0xd0, 0xa1, 0x35, 0x00, 0x00, 0x00, 0x01, 0x68, 0xfe, 0x06,
+ 0xe2, 0x00, 0x00, 0x00, 0x01, 0x65, 0xb8, 0x40, 0xf0, 0x8c, 0x03, 0xf2,
+ 0x75, 0x67, 0xad, 0x41, 0x64, 0x24, 0x0e, 0xa0, 0xb2, 0x12, 0x1e, 0xf8,
+};
+
+// Contains enough of the image slice to contain slice QP.
+uint8_t kH264BitstreamNextImageSliceChunkCABAC[] = {
+ 0x00, 0x00, 0x00, 0x01, 0x41, 0xe2, 0x01, 0x16, 0x0e, 0x3e, 0x2b, 0x86,
+};
+
TEST(H264BitstreamParserTest, ReportsNoQpWithoutParsedSlices) {
H264BitstreamParser h264_parser;
int qp;
@@ -59,4 +71,19 @@ TEST(H264BitstreamParserTest, ReportsLastSliceQpForImageSlices) {
EXPECT_EQ(37, qp);
}
+TEST(H264BitstreamParserTest, ReportsLastSliceQpForCABACImageSlices) {
+ H264BitstreamParser h264_parser;
+ h264_parser.ParseBitstream(kH264BitstreamChunkCABAC,
+ sizeof(kH264BitstreamChunkCABAC));
+ int qp;
+ ASSERT_TRUE(h264_parser.GetLastSliceQp(&qp));
+ EXPECT_EQ(35, qp);
+
+ // Parse an additional image slice.
+ h264_parser.ParseBitstream(kH264BitstreamNextImageSliceChunkCABAC,
+ sizeof(kH264BitstreamNextImageSliceChunkCABAC));
+ ASSERT_TRUE(h264_parser.GetLastSliceQp(&qp));
+ EXPECT_EQ(20, qp);
+}
+
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698