30 #define MAX_RLE_BULK 127
32 #define MAX_RLE_REPEAT 128
34 #define MAX_RLE_SKIP 254
117 unsigned int bulkcount;
120 unsigned int skipcount;
128 int total_repeat_cost;
133 uint8_t *this_line = p->
data[0] + line*p-> linesize[0] +
141 for (i = width - 1; i >= 0; i--) {
166 if (repeatcount > 1 && (skipcount == 0 || total_repeat_cost < total_skip_cost)) {
171 else if (skipcount > 0) {
183 total_bulk_cost = INT_MAX;
185 for (j = 1; j <= limit; j++) {
186 if (s->
length_table[i + j] + temp_cost < total_bulk_cost) {
211 bytestream_put_byte(buf, s->
skip_table[0] + 1);
214 else bytestream_put_byte(buf, 1);
219 bytestream_put_byte(buf, rlecode);
222 bytestream_put_byte(buf, s->
skip_table[i] + 1);
225 else if (rlecode > 0) {
236 bytestream_put_byte(buf, -1);
245 uint8_t *orig_buf = buf;
249 for (start_line = 0; start_line < s->
avctx->
height; start_line++)
255 for (end_line=s->
avctx->
height; end_line > start_line; end_line--)
262 bytestream_put_be32(&buf, 0);
265 bytestream_put_be16(&buf, 0);
267 bytestream_put_be16(&buf, 8);
268 bytestream_put_be16(&buf, start_line);
269 bytestream_put_be16(&buf, 0);
270 bytestream_put_be16(&buf, end_line - start_line);
271 bytestream_put_be16(&buf, 0);
273 for (i = start_line; i < end_line; i++)
276 bytestream_put_byte(&buf, 0);
277 AV_WB32(orig_buf, buf - orig_buf);
278 return buf - orig_buf;
290 if (buf_size < s->max_buf_size) {