Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -95,16 +95,13 @@ error: · 94 unmodified lines | ||
| 95 | 95 | static inline void write_frame_ ##D(AVFrame *frame, GetByteContext *g, \ |
| 96 | 96 | int width, int height, int sign, int depth) \ |
| 97 | 97 | { \ |
| 98 | + const unsigned offset = sign ? (1 << (D - 1)) : 0; \ | |
| 98 | 99 | int i, j; \ |
| 99 | 100 | for (i = 0; i < height; i++) { \ |
| 100 | 101 | PIXEL *line = (PIXEL*)(frame->data[0] + i * frame->linesize[0]); \ |
| 101 | 102 | 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; \ | |
| 108 | 105 | *(line + j) = val; \ |
| 109 | 106 | } \ |
| 110 | 107 | } \ |