31 #define MAX_RLE_BULK 127
33 #define MAX_RLE_REPEAT 128
35 #define MAX_RLE_SKIP 254
118 unsigned int bulkcount;
121 unsigned int skipcount;
124 unsigned int repeatcount;
129 int total_repeat_cost;
134 uint8_t *this_line = p->
data[0] + line*p-> linesize[0] +
142 for (i = width - 1; i >= 0; i--) {
167 if (repeatcount > 1 && (skipcount == 0 || total_repeat_cost < total_skip_cost)) {
172 else if (skipcount > 0) {
184 total_bulk_cost = INT_MAX;
186 for (j = 1; j <= limit; j++) {
187 if (s->
length_table[i + j] + temp_cost < total_bulk_cost) {
212 bytestream_put_byte(buf, s->
skip_table[0] + 1);
215 else bytestream_put_byte(buf, 1);
220 bytestream_put_byte(buf, rlecode);
223 bytestream_put_byte(buf, s->
skip_table[i] + 1);
226 else if (rlecode > 0) {
237 bytestream_put_byte(buf, -1);
250 for (start_line = 0; start_line < s->
avctx->
height; start_line++)
256 for (end_line=s->
avctx->
height; end_line > start_line; end_line--)
263 bytestream_put_be32(&buf, 0);
266 bytestream_put_be16(&buf, 0);
268 bytestream_put_be16(&buf, 8);
269 bytestream_put_be16(&buf, start_line);
270 bytestream_put_be16(&buf, 0);
271 bytestream_put_be16(&buf, end_line - start_line);
272 bytestream_put_be16(&buf, 0);
274 for (i = start_line; i < end_line; i++)
277 bytestream_put_byte(&buf, 0);
278 AV_WB32(orig_buf, buf - orig_buf);
279 return buf - orig_buf;
283 const AVFrame *pict,
int *got_packet)