History

avformat/evc: Don't cast const away, avoid loop

Andreas Rheinhardt committed 3 years ago

Commit e52676e1 parent e5ab2da1 file · +6 −11Browse files

Unified · Split

libavformat/evc.h+6−11
@@ -23,16 +23,17 @@ · 22 unmodified lines
2323 #define AVFORMAT_EVC_H
2424
2525 #include <stdint.h>
26+
27+#include "libavutil/intreadwrite.h"
2628 #include "libavutil/rational.h"
2729 #include "libavcodec/evc.h"
2830 #include "avio.h"
2931
30−static inline int evc_get_nalu_type(const uint8_t *bits, int bits_size)
32+static inline int evc_get_nalu_type(const uint8_t *p, int bits_size)
3133 {
3234 int unit_type_plus1 = 0;
3335
3436 if (bits_size >= EVC_NALU_HEADER_SIZE) {
35− unsigned char *p = (unsigned char *)bits;
3637 // forbidden_zero_bit
3738 if ((p[0] & 0x80) != 0) // Cannot get bitstream information. Malformed bitstream.
3839 return -1;
@@ -46,16 +47,10 @@ static inline int evc_get_nalu_type(const uint8_t *bits, int bits_size) · 7 unmodified lines
4647
4748 static inline uint32_t evc_read_nal_unit_length(const uint8_t *bits, int bits_size)
4849 {
49− uint32_t nalu_len = 0;
50−
51− if (bits_size >= EVC_NALU_LENGTH_PREFIX_SIZE) {
52− unsigned char *p = (unsigned char *)bits;
53−
54− for (int i = 0; i < EVC_NALU_LENGTH_PREFIX_SIZE; i++)
55− nalu_len = (nalu_len << 8) | p[i];
56− }
50+ if (bits_size >= EVC_NALU_LENGTH_PREFIX_SIZE)
51+ return AV_RB32(bits);
5752
58− return nalu_len;
53+ return 0;
5954 }
6055
6156 /**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t