31 #define MAX_RLE_BULK 127
33 #define MAX_RLE_REPEAT 128
35 #define MAX_RLE_SKIP 254
128 unsigned int skipcount;
136 int total_repeat_cost;
141 uint8_t *this_line = p->
data[0] + line*p-> linesize[0] +
149 for (i = width - 1; i >= 0; i--) {
174 if (repeatcount > 1 && (skipcount == 0 || total_repeat_cost < total_skip_cost)) {
179 else if (skipcount > 0) {
191 total_bulk_cost = INT_MAX;
193 for (j = 1; j <= limit; j++) {
194 if (s->
length_table[i + j] + temp_cost < total_bulk_cost) {
219 bytestream_put_byte(buf, s->
skip_table[0] + 1);
222 else bytestream_put_byte(buf, 1);
227 bytestream_put_byte(buf, rlecode);
230 bytestream_put_byte(buf, s->
skip_table[i] + 1);
233 else if (rlecode > 0) {
241 bytestream_put_byte(buf, *(this_line + i*s->
pixel_size + j) ^ 0xff);
253 bytestream_put_byte(buf, *(this_line + i*s->
pixel_size + j) ^ 0xff);
260 bytestream_put_byte(buf, -1);
273 for (start_line = 0; start_line < s->
avctx->
height; start_line++)
279 for (end_line=s->
avctx->
height; end_line > start_line; end_line--)
286 bytestream_put_be32(&buf, 0);
289 bytestream_put_be16(&buf, 0);
291 bytestream_put_be16(&buf, 8);
292 bytestream_put_be16(&buf, start_line);
293 bytestream_put_be16(&buf, 0);
294 bytestream_put_be16(&buf, end_line - start_line);
295 bytestream_put_be16(&buf, 0);
297 for (i = start_line; i < end_line; i++)
300 bytestream_put_byte(&buf, 0);
301 AV_WB32(orig_buf, buf - orig_buf);
302 return buf - orig_buf;
306 const AVFrame *pict,
int *got_packet)