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;
268 bytestream_put_be16(&q, page_id);
276 for (region_id = 0; region_id < h->
num_rects; region_id++) {
279 bytestream_put_be16(&q, h->
rects[region_id]->
x);
280 bytestream_put_be16(&q, h->
rects[region_id]->
y);
283 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
286 for (clut_id = 0; clut_id < h->
num_rects; clut_id++) {
307 bytestream_put_be16(&q, page_id);
311 *q++ = (0 << 4) | 0xf;
315 *q++ = (1 << (7 - bpp_index)) | (0xf << 1) | 1;
318 uint32_t x= ((uint32_t*)h->
rects[clut_id]->
data[1])[i];
319 a = (x >> 24) & 0xff;
320 r = (x >> 16) & 0xff;
331 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
335 for (region_id = 0; region_id < h->
num_rects; region_id++) {
351 bytestream_put_be16(&q, page_id);
356 bytestream_put_be16(&q, h->
rects[region_id]->
w);
357 bytestream_put_be16(&q, h->
rects[region_id]->
h);
358 *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03;
363 bytestream_put_be16(&q, region_id);
364 *q++ = (0 << 6) | (0 << 4);
369 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
374 for (object_id = 0; object_id < h->
num_rects; object_id++) {
376 const uint8_t *bitmap,
int linesize,
396 bytestream_put_be16(&q, page_id);
400 bytestream_put_be16(&q, object_id);
405 uint8_t *ptop_field_len, *pbottom_field_len, *top_ptr, *bottom_ptr;
409 pbottom_field_len = q;
413 dvb_encode_rle(&q, h->
rects[object_id]->
data[0], h->
rects[object_id]->
w * 2,
416 dvb_encode_rle(&q, h->
rects[object_id]->
data[0] + h->
rects[object_id]->
w,
418 h->
rects[object_id]->
h >> 1);
420 bytestream_put_be16(&ptop_field_len, bottom_ptr - top_ptr);
421 bytestream_put_be16(&pbottom_field_len, q - bottom_ptr);
424 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
432 bytestream_put_be16(&q, page_id);
436 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
443 unsigned char *
buf,
int buf_size,
int x
top left corner of pict, undefined when pict is not set
int nb_colors
number of colors in pict, undefined when pict is not set
Various defines for YUV<->RGB conversion.
static int encode_dvb_subtitles(DVBSubtitleContext *s, uint8_t *outbuf, const AVSubtitle *h)
AVCodec ff_dvbsub_encoder
int w
width of pict, undefined when pict is not set
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
int h
height of pict, undefined when pict is not set
static void dvb_encode_rle4(uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int 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.
static int dvbsub_encode(AVCodecContext *avctx, unsigned char *buf, int buf_size, const AVSubtitle *sub)
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
uint8_t * data[4]
data+linesize for the bitmap of this subtitle.
Libavcodec external API header.
main external API structure.
#define RGB_TO_U_CCIR(r1, g1, b1, shift)
#define RGB_TO_V_CCIR(r1, g1, b1, shift)
#define RGB_TO_Y_CCIR(r, g, b)
static void dvb_encode_rle8(uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int h)
static void dvb_encode_rle2(uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int h)