History

avcodec/pgxdec: Hoist branch out of loop

Andreas Rheinhardt committed 4 years ago

Commit 84a80ac1 parent e4a26a61 file · +3 −6Browse files

Unified · Split

libavcodec/pgxdec.c+3−6
@@ -95,16 +95,13 @@ error: · 94 unmodified lines
9595 static inline void write_frame_ ##D(AVFrame *frame, GetByteContext *g, \
9696 int width, int height, int sign, int depth) \
9797 { \
98+ const unsigned offset = sign ? (1 << (D - 1)) : 0; \
9899 int i, j; \
99100 for (i = 0; i < height; i++) { \
100101 PIXEL *line = (PIXEL*)(frame->data[0] + i * frame->linesize[0]); \
101102 for (j = 0; j < width; j++) { \
102− unsigned val; \
103− if (sign) \
104− val = (PIXEL)bytestream2_get_ ##suffix##u(g) + (1 << (depth - 1)); \
105− else \
106− val = bytestream2_get_ ##suffix##u(g); \
107− val <<= (D - depth); \
103+ unsigned val = bytestream2_get_ ##suffix##u(g) << (D - depth); \
104+ val ^= offset; \
108105 *(line + j) = val; \
109106 } \
110107 } \

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