31 #define BITSTREAM_WRITER_LE
66 for (y = 0; y < h; y++) {
67 for (x = 0; x < w; x++)
93 int x_end = avctx->
width - 1,
97 while (y_start < y_end) {
98 if (memcmp(ref + y_start*ref_linesize, buf + y_start*linesize,
width))
102 while (y_end > y_start) {
103 if (memcmp(ref + y_end*ref_linesize, buf + y_end*linesize,
width))
107 height = y_end + 1 - y_start;
110 while (x_start < x_end) {
112 for (y = y_start; y <= y_end; y++) {
113 if (ref[y*ref_linesize + x_start] != buf[y*linesize + x_start]) {
122 while (x_end > x_start) {
124 for (y = y_start; y <= y_end; y++) {
125 if (ref[y*ref_linesize + x_end] != buf[y*linesize + x_end]) {
134 width = x_end + 1 - x_start;
142 bytestream_put_le16(bytestream, x_start);
143 bytestream_put_le16(bytestream, y_start);
144 bytestream_put_le16(bytestream,
width);
145 bytestream_put_le16(bytestream,
height);
148 bytestream_put_byte(bytestream, 0x00);
151 bytestream_put_byte(bytestream, 1<<7 | 0x7);
153 const uint32_t
v = palette[i];
154 bytestream_put_be24(bytestream, v);
158 if (honor_transparency && trans < 0) {
174 honor_transparency = 0;
176 bytestream_put_byte(bytestream, 0x08);
181 ptr = buf + y_start*linesize + x_start;
182 if (honor_transparency) {
186 for (y = 0; y <
height; y++) {
188 for (x = 0; x <
width; x++)
189 if (ref[x] == ptr[x])
196 for (y = 0; y <
height; y++) {
206 bytestream_put_byte(bytestream, size);
207 if (end - *bytestream < size)
213 bytestream_put_byte(bytestream, 0x00);
221 if (avctx->
width > 65535 || avctx->
height > 65535) {
251 int transparent_color_index = -1;
252 unsigned i, smallest_alpha = 0xff;
258 const uint32_t
v = palette[i];
259 if (v >> 24 < smallest_alpha) {
260 smallest_alpha = v >> 24;
261 transparent_color_index = i;
264 return smallest_alpha < 128 ? transparent_color_index : -1;
268 const AVFrame *pict,
int *got_packet)
277 outbuf_ptr = pkt->
data;
285 palette = (uint32_t*)pict->
data[1];
335 #define OFFSET(x) offsetof(GIFContext, x)
336 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM