29 #define PUTBITS2(val)\ 31 bitbuf |= (val) << bitcnt;\ 41 const uint8_t *bitmap,
int linesize,
51 for(y = 0; y < h; y++) {
60 while (x1 < w && bitmap[x1] == color)
63 if (color == 0 && len == 2) {
67 }
else if (len >= 3 && len <= 10) {
73 }
else if (len >= 12 && len <= 27) {
81 }
else if (len >= 29) {
116 #define PUTBITS4(val)\ 118 bitbuf |= (val) << bitcnt;\ 129 const uint8_t *bitmap,
int linesize,
139 for(y = 0; y < h; y++) {
147 color = bitmap[x1++];
148 while (x1 < w && bitmap[x1] == color)
151 if (color == 0 && len == 2) {
154 }
else if (color == 0 && (len >= 3 && len <= 9)) {
157 }
else if (len >= 4 && len <= 7) {
161 }
else if (len >= 9 && len <= 24) {
166 }
else if (len >= 25) {
197 const uint8_t *bitmap,
int linesize,
205 for (y = 0; y < h; y++) {
211 color = bitmap[x1++];
212 while (x1 < w && bitmap[x1] == color)
215 if (len == 1 && color) {
221 len =
FFMIN(len, 127);
224 }
else if (len > 2) {
226 len =
FFMIN(len, 127);
254 int page_id, region_id, clut_id, object_id,
i, bpp_index, page_state;
270 bytestream_put_be16(&q, page_id);
278 for (region_id = 0; region_id < h->
num_rects; region_id++) {
281 bytestream_put_be16(&q, h->
rects[region_id]->
x);
282 bytestream_put_be16(&q, h->
rects[region_id]->
y);
285 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
288 for (clut_id = 0; clut_id < h->
num_rects; clut_id++) {
309 bytestream_put_be16(&q, page_id);
313 *q++ = (0 << 4) | 0xf;
317 *q++ = (1 << (7 - bpp_index)) | (0xf << 1) | 1;
321 a = (x >> 24) & 0xff;
322 r = (x >> 16) & 0xff;
333 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
337 for (region_id = 0; region_id < h->
num_rects; region_id++) {
353 bytestream_put_be16(&q, page_id);
358 bytestream_put_be16(&q, h->
rects[region_id]->
w);
359 bytestream_put_be16(&q, h->
rects[region_id]->
h);
360 *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03;
365 bytestream_put_be16(&q, region_id);
366 *q++ = (0 << 6) | (0 << 4);
371 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
376 for (object_id = 0; object_id < h->
num_rects; object_id++) {
378 const uint8_t *bitmap,
int linesize,
398 bytestream_put_be16(&q, page_id);
402 bytestream_put_be16(&q, object_id);
407 uint8_t *ptop_field_len, *pbottom_field_len, *top_ptr, *bottom_ptr;
411 pbottom_field_len = q;
420 h->
rects[object_id]->
h >> 1);
422 bytestream_put_be16(&ptop_field_len, bottom_ptr - top_ptr);
423 bytestream_put_be16(&pbottom_field_len, q - bottom_ptr);
426 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
434 bytestream_put_be16(&q, page_id);
438 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
447 unsigned char *
buf,
int buf_size,
int x
top left corner of pict, undefined when pict is not set
static int dvbsub_encode(AVCodecContext *avctx, unsigned char *buf, int buf_size, const AVSubtitle *sub)
AVCodec ff_dvbsub_encoder
int nb_colors
number of colors in pict, undefined when pict is not set
Various defines for YUV<->RGB conversion.
output residual component w
int w
width of pict, undefined when pict is not set
static void dvb_encode_rle8(uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int h)
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
uint8_t * data[AV_NUM_DATA_POINTERS]
int h
height of pict, undefined when pict is not set
static int encode_dvb_subtitles(DVBSubtitleContext *s, uint8_t *outbuf, const AVSubtitle *h)
int y
top left corner of pict, undefined when pict is not set
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const char * name
Name of the codec implementation.
AVPicture pict
data+linesize for the bitmap of this subtitle.
typedef void(RENAME(mix_any_func_type))
main external API structure.
synthesis window for stochastic i
struct DVBSubtitleContext DVBSubtitleContext
#define RGB_TO_U_CCIR(r1, g1, b1, shift)
#define RGB_TO_V_CCIR(r1, g1, b1, shift)
static void dvb_encode_rle2(uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int h)
static void dvb_encode_rle4(uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int h)
#define RGB_TO_Y_CCIR(r, g, b)