39 #define BITSTREAM_WRITER_LE
62 for (y = 0; y < h; y++) {
63 for (x = 0; x < w; x++)
81 int x_start = 0, y_start = 0, trans = -1;
89 int x_end = avctx->
width - 1,
93 while (y_start < y_end) {
94 if (memcmp(ref + y_start*ref_linesize, buf + y_start*linesize,
width))
98 while (y_end > y_start) {
99 if (memcmp(ref + y_end*ref_linesize, buf + y_end*linesize,
width))
103 height = y_end + 1 - y_start;
106 while (x_start < x_end) {
108 for (y = y_start; y < y_end; y++) {
109 if (ref[y*ref_linesize + x_start] != buf[y*linesize + x_start]) {
118 while (x_end > x_start) {
120 for (y = y_start; y < y_end; y++) {
121 if (ref[y*ref_linesize + x_end] != buf[y*linesize + x_end]) {
130 width = x_end + 1 - x_start;
138 bytestream_put_le16(bytestream, x_start);
139 bytestream_put_le16(bytestream, y_start);
140 bytestream_put_le16(bytestream,
width);
141 bytestream_put_le16(bytestream,
height);
144 bytestream_put_byte(bytestream, 0x00);
147 bytestream_put_byte(bytestream, 1<<7 | 0x7);
149 const uint32_t
v = palette[i];
150 bytestream_put_be24(bytestream, v);
165 pal_exdata[trans*4 + 3*!HAVE_BIGENDIAN] = 0x00;
169 bytestream_put_byte(bytestream, 0x08);
174 ptr = buf + y_start*linesize + x_start;
179 for (y = 0; y <
height; y++) {
181 for (x = 0; x <
width; x++)
182 if (ref[x] == ptr[x])
189 for (y = 0; y <
height; y++) {
199 bytestream_put_byte(bytestream, size);
200 if (end - *bytestream < size)
206 bytestream_put_byte(bytestream, 0x00);
214 if (avctx->
width > 65535 || avctx->
height > 65535) {
232 const AVFrame *pict,
int *got_packet)
237 const uint32_t *
palette = NULL;
242 outbuf_ptr = pkt->
data;
253 palette = (uint32_t*)p->
data[1];
286 #define OFFSET(x) offsetof(GIFContext, x)
287 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM