31 #define BITSTREAM_WRITER_LE
65 for (y = 0; y < h; y++) {
66 for (x = 0; x < w; x++)
92 int x_end = avctx->
width - 1,
96 while (y_start < y_end) {
97 if (memcmp(ref + y_start*ref_linesize, buf + y_start*linesize,
width))
101 while (y_end > y_start) {
102 if (memcmp(ref + y_end*ref_linesize, buf + y_end*linesize,
width))
106 height = y_end + 1 - y_start;
109 while (x_start < x_end) {
111 for (y = y_start; y <= y_end; y++) {
112 if (ref[y*ref_linesize + x_start] != buf[y*linesize + x_start]) {
121 while (x_end > x_start) {
123 for (y = y_start; y <= y_end; y++) {
124 if (ref[y*ref_linesize + x_end] != buf[y*linesize + x_end]) {
133 width = x_end + 1 - x_start;
141 bytestream_put_le16(bytestream, x_start);
142 bytestream_put_le16(bytestream, y_start);
143 bytestream_put_le16(bytestream,
width);
144 bytestream_put_le16(bytestream,
height);
147 bytestream_put_byte(bytestream, 0x00);
150 bytestream_put_byte(bytestream, 1<<7 | 0x7);
152 const uint32_t
v = palette[i];
153 bytestream_put_be24(bytestream, v);
157 if (honor_transparency && trans < 0) {
169 pal_exdata[trans*4 + 3*!HAVE_BIGENDIAN] = 0x00;
173 honor_transparency = 0;
175 bytestream_put_byte(bytestream, 0x08);
180 ptr = buf + y_start*linesize + x_start;
181 if (honor_transparency) {
185 for (y = 0; y <
height; y++) {
187 for (x = 0; x <
width; x++)
188 if (ref[x] == ptr[x])
195 for (y = 0; y <
height; y++) {
205 bytestream_put_byte(bytestream, size);
206 if (end - *bytestream < size)
212 bytestream_put_byte(bytestream, 0x00);
220 if (avctx->
width > 65535 || avctx->
height > 65535) {
249 int transparent_color_index = -1;
250 unsigned i, smallest_alpha = 0xff;
256 const uint32_t
v = palette[i];
257 if (v >> 24 < smallest_alpha) {
258 smallest_alpha = v >> 24;
259 transparent_color_index = i;
262 return smallest_alpha < 128 ? transparent_color_index : -1;
266 const AVFrame *pict,
int *got_packet)
275 outbuf_ptr = pkt->
data;
283 palette = (uint32_t*)pict->
data[1];
332 #define OFFSET(x) offsetof(GIFContext, x)
333 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM