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

Side by Side Diff: webrtc/modules/video_coding/utility/vp8_header_parser.h

Issue 1888313002: Fix the issue of undefined-shift in VP8GetBit. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Use error_ to save bitReader status. Created 4 years, 8 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 17 matching lines...) Expand all
28 typedef struct VP8BitReader VP8BitReader; 28 typedef struct VP8BitReader VP8BitReader;
29 struct VP8BitReader { 29 struct VP8BitReader {
30 // Boolean decoder. 30 // Boolean decoder.
31 uint32_t value_; // Current value. 31 uint32_t value_; // Current value.
32 uint32_t range_; // Current range minus 1. In [127, 254] interval. 32 uint32_t range_; // Current range minus 1. In [127, 254] interval.
33 int bits_; // Number of valid bits left. 33 int bits_; // Number of valid bits left.
34 // Read buffer. 34 // Read buffer.
35 const uint8_t* buf_; // Next byte to be read. 35 const uint8_t* buf_; // Next byte to be read.
36 const uint8_t* buf_end_; // End of read buffer. 36 const uint8_t* buf_end_; // End of read buffer.
37 int eof_; // True if input is exhausted. 37 int eof_; // True if input is exhausted.
38 bool error_; // True if input stream contains an error.
38 }; 39 };
39 40
40 const uint8_t kVP8Log2Range[128] = { 41 const uint8_t kVP8Log2Range[128] = {
41 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 42 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3,
42 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 43 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
43 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 44 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
44 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 45 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
45 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 46 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
46 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}; 47 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0};
47 48
(...skipping 11 matching lines...) Expand all
59 60
60 // Gets the QP, QP range: [0, 127]. 61 // Gets the QP, QP range: [0, 127].
61 // Returns true on success, false otherwise. 62 // Returns true on success, false otherwise.
62 bool GetQp(const uint8_t* buf, size_t length, int* qp); 63 bool GetQp(const uint8_t* buf, size_t length, int* qp);
63 64
64 } // namespace vp8 65 } // namespace vp8
65 66
66 } // namespace webrtc 67 } // namespace webrtc
67 68
68 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_ 69 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_VP8_HEADER_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698