Commit 67a804b9 authored by Nicolas George's avatar Nicolas George

dvdsubenc: reindent after recent commit.

parent 2d3acbfe
...@@ -314,19 +314,18 @@ static int encode_dvd_subtitles(AVCodecContext *avctx, ...@@ -314,19 +314,18 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
// encode data block // encode data block
q = outbuf + 4; q = outbuf + 4;
/* TODO reindent */ offset1 = q - outbuf;
offset1 = q - outbuf; // worst case memory requirement: 1 nibble per pixel..
// worst case memory requirement: 1 nibble per pixel.. if ((q - outbuf) + vrect.w * vrect.h / 2 + 17 + 21 > outbuf_size) {
if ((q - outbuf) + vrect.w * vrect.h / 2 + 17 + 21 > outbuf_size) { av_log(NULL, AV_LOG_ERROR, "dvd_subtitle too big\n");
av_log(NULL, AV_LOG_ERROR, "dvd_subtitle too big\n"); ret = AVERROR_BUFFER_TOO_SMALL;
ret = AVERROR_BUFFER_TOO_SMALL; goto fail;
goto fail; }
} dvd_encode_rle(&q, vrect.pict.data[0], vrect.w * 2,
dvd_encode_rle(&q, vrect.pict.data[0], vrect.w * 2, vrect.w, (vrect.h + 1) >> 1, cmap);
vrect.w, (vrect.h + 1) >> 1, cmap); offset2 = q - outbuf;
offset2 = q - outbuf; dvd_encode_rle(&q, vrect.pict.data[0] + vrect.w, vrect.w * 2,
dvd_encode_rle(&q, vrect.pict.data[0] + vrect.w, vrect.w * 2, vrect.w, vrect.h >> 1, cmap);
vrect.w, vrect.h >> 1, cmap);
// set data packet size // set data packet size
qq = outbuf + 2; qq = outbuf + 2;
...@@ -343,24 +342,23 @@ static int encode_dvd_subtitles(AVCodecContext *avctx, ...@@ -343,24 +342,23 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
*q++ = (out_alpha[1] & 0xF0) | (out_alpha[0] >> 4); *q++ = (out_alpha[1] & 0xF0) | (out_alpha[0] >> 4);
// 12 bytes per rect // 12 bytes per rect
/* TODO reindent */ x2 = vrect.x + vrect.w - 1;
x2 = vrect.x + vrect.w - 1; y2 = vrect.y + vrect.h - 1;
y2 = vrect.y + vrect.h - 1;
*q++ = 0x05;
*q++ = 0x05; // x1 x2 -> 6 nibbles
// x1 x2 -> 6 nibbles *q++ = vrect.x >> 4;
*q++ = vrect.x >> 4; *q++ = (vrect.x << 4) | ((x2 >> 8) & 0xf);
*q++ = (vrect.x << 4) | ((x2 >> 8) & 0xf); *q++ = x2;
*q++ = x2; // y1 y2 -> 6 nibbles
// y1 y2 -> 6 nibbles *q++ = vrect.y >> 4;
*q++ = vrect.y >> 4; *q++ = (vrect.y << 4) | ((y2 >> 8) & 0xf);
*q++ = (vrect.y << 4) | ((y2 >> 8) & 0xf); *q++ = y2;
*q++ = y2;
*q++ = 0x06;
*q++ = 0x06; // offset1, offset2
// offset1, offset2 bytestream_put_be16(&q, offset1);
bytestream_put_be16(&q, offset1); bytestream_put_be16(&q, offset2);
bytestream_put_be16(&q, offset2);
*q++ = 0x01; // start command *q++ = 0x01; // start command
*q++ = 0xff; // terminating command *q++ = 0xff; // terminating command
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment