Revision 74bf9d62

View differences:

libavcodec/v210enc.c
66 66
        return -1;
67 67
    }
68 68

  
69
#define CLIP(v) av_clip(v, 4, 1019)
70

  
69 71
#define WRITE_PIXELS(a, b, c)           \
70 72
    do {                                \
71
        val =   *a++;             \
72
        val |= (*b++ << 10) |     \
73
               (*c++ << 20);      \
73
        val =   CLIP(*a++);             \
74
        val |= (CLIP(*b++) << 10) |     \
75
               (CLIP(*c++) << 20);      \
74 76
        bytestream_put_le32(&p, val);   \
75 77
    } while (0)
76 78

  
......
85 87
        if (w < avctx->width - 1) {
86 88
            WRITE_PIXELS(u, y, v);
87 89

  
88
            val =   *y++;
90
            val = CLIP(*y++);
89 91
            if (w == avctx->width - 2)
90 92
                bytestream_put_le32(&p, val);
91 93
        }
92 94
        if (w < avctx->width - 3) {
93
            val |= (*u++ << 10) | (*y++ << 20);
95
            val |= (CLIP(*u++) << 10) | (CLIP(*y++) << 20);
94 96
            bytestream_put_le32(&p, val);
95 97

  
96
            val = *v++ | (*y++ << 10);
98
            val = CLIP(*v++) | (CLIP(*y++) << 10);
97 99
            bytestream_put_le32(&p, val);
98 100
        }
99 101

  

Also available in: Unified diff