31 #define MAX_RLE_BULK 127
33 #define MAX_RLE_REPEAT 128
35 #define MAX_RLE_SKIP 254
136 unsigned int bulkcount;
139 unsigned int skipcount;
142 unsigned int repeatcount;
147 int total_repeat_cost;
152 uint8_t *this_line = p->
data[0] + line*p-> linesize[0] +
160 for (i = width - 1; i >= 0; i--) {
185 if (repeatcount > 1 && (skipcount == 0 || total_repeat_cost < total_skip_cost)) {
190 else if (skipcount > 0) {
202 total_bulk_cost = INT_MAX;
204 for (j = 1; j <= limit; j++) {
205 if (s->
length_table[i + j] + temp_cost < total_bulk_cost) {
230 bytestream_put_byte(buf, s->
skip_table[0] + 1);
233 else bytestream_put_byte(buf, 1);
238 bytestream_put_byte(buf, rlecode);
241 bytestream_put_byte(buf, s->
skip_table[i] + 1);
244 else if (rlecode > 0) {
255 bytestream_put_byte(buf, -1);
268 for (start_line = 0; start_line < s->
avctx->
height; start_line++)
274 for (end_line=s->
avctx->
height; end_line > start_line; end_line--)
281 bytestream_put_be32(&buf, 0);
284 bytestream_put_be16(&buf, 0);
286 bytestream_put_be16(&buf, 8);
287 bytestream_put_be16(&buf, start_line);
288 bytestream_put_be16(&buf, 0);
289 bytestream_put_be16(&buf, end_line - start_line);
290 bytestream_put_be16(&buf, 0);
292 for (i = start_line; i < end_line; i++)
295 bytestream_put_byte(&buf, 0);
296 AV_WB32(orig_buf, buf - orig_buf);
297 return buf - orig_buf;
301 const AVFrame *pict,
int *got_packet)