29 #define PUTBITS2(val)\ 31 bitbuf |= (val) << bitcnt;\ 41 const uint8_t *bitmap,
int linesize,
51 for(y = 0; y <
h; y++) {
53 if (buf_size * 8 < w * 3 + 32)
64 while (x1 < w && bitmap[x1] == color)
67 if (color == 0 && len == 2) {
71 }
else if (len >= 3 && len <= 10) {
77 }
else if (len >= 12 && len <= 27) {
85 }
else if (len >= 29) {
116 buf_size -= q - line_begin;
123 #define PUTBITS4(val)\ 125 bitbuf |= (val) << bitcnt;\ 136 const uint8_t *bitmap,
int linesize,
146 for(y = 0; y <
h; y++) {
148 if (buf_size * 8 < w * 6 + 32)
158 color = bitmap[x1++];
159 while (x1 < w && bitmap[x1] == color)
162 if (color == 0 && len == 2) {
165 }
else if (color == 0 && (len >= 3 && len <= 9)) {
168 }
else if (len >= 4 && len <= 7) {
172 }
else if (len >= 9 && len <= 24) {
177 }
else if (len >= 25) {
203 buf_size -= q - line_begin;
211 const uint8_t *bitmap,
int linesize,
219 for (y = 0; y <
h; y++) {
221 if (buf_size * 8 < w * 12 + 24)
229 color = bitmap[x1++];
230 while (x1 < w && bitmap[x1] == color)
233 if (len == 1 && color) {
239 len =
FFMIN(len, 127);
242 }
else if (len > 2) {
244 len =
FFMIN(len, 127);
264 buf_size -= q - line_begin;
276 int page_id, region_id, clut_id, object_id,
i, bpp_index, page_state;
292 bytestream_put_be16(&q, page_id);
296 bytestream_put_be16(&q, avctx->
width - 1);
297 bytestream_put_be16(&q, avctx->
height - 1);
298 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
304 if (buf_size < 8 + h->num_rects * 6)
308 bytestream_put_be16(&q, page_id);
316 for (region_id = 0; region_id < h->
num_rects; region_id++) {
319 bytestream_put_be16(&q, h->
rects[region_id]->
x);
320 bytestream_put_be16(&q, h->
rects[region_id]->
y);
323 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
327 for (clut_id = 0; clut_id < h->
num_rects; clut_id++) {
328 if (buf_size < 6 + h->rects[clut_id]->nb_colors * 6)
350 bytestream_put_be16(&q, page_id);
354 *q++ = (0 << 4) | 0
xf;
358 *q++ = (1 << (7 - bpp_index)) | (0xf << 1) | 1;
361 uint32_t x= ((uint32_t*)h->
rects[clut_id]->
data[1])[
i];
362 a = (x >> 24) & 0xff;
363 r = (x >> 16) & 0xff;
374 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
378 if (buf_size < h->num_rects * 22)
380 for (region_id = 0; region_id < h->
num_rects; region_id++) {
399 bytestream_put_be16(&q, page_id);
404 bytestream_put_be16(&q, h->
rects[region_id]->
w);
405 bytestream_put_be16(&q, h->
rects[region_id]->
h);
406 *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03;
411 bytestream_put_be16(&q, region_id);
412 *q++ = (0 << 6) | (0 << 4);
417 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
421 for (object_id = 0; object_id < h->
num_rects; object_id++) {
422 int (*dvb_encode_rle)(
uint8_t **pq,
int buf_size,
423 const uint8_t *bitmap,
int linesize,
446 bytestream_put_be16(&q, page_id);
450 bytestream_put_be16(&q, object_id);
455 uint8_t *ptop_field_len, *pbottom_field_len, *top_ptr, *bottom_ptr;
460 pbottom_field_len = q;
465 ret = dvb_encode_rle(&q, buf_size,
467 h->
rects[object_id]->
w * 2,
469 h->
rects[object_id]->
h >> 1);
474 ret = dvb_encode_rle(&q, buf_size,
476 h->
rects[object_id]->
w * 2,
478 h->
rects[object_id]->
h >> 1);
483 bytestream_put_be16(&ptop_field_len, bottom_ptr - top_ptr);
484 bytestream_put_be16(&pbottom_field_len, q - bottom_ptr);
487 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
497 bytestream_put_be16(&q, page_id);
501 bytestream_put_be16(&pseg_len, q - pseg_len - 2);
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
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
static int dvb_encode_rle4(uint8_t **pq, int buf_size, const uint8_t *bitmap, int linesize, int w, int h)
int w
width of pict, undefined when pict is not set
static int dvb_encode_rle2(uint8_t **pq, int buf_size, const uint8_t *bitmap, int linesize, int w, int h)
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
int h
height of pict, undefined when pict is not set
static int dvb_encode_rle8(uint8_t **pq, int buf_size, const uint8_t *bitmap, int linesize, int w, int h)
Various defines for YUV<->RGB conversion.
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. ...
#define RGB_TO_U_CCIR(r1, g1, b1, shift)
const char * name
Name of the codec implementation.
#define AVERROR_BUFFER_TOO_SMALL
Buffer too small.
int width
picture width / height.
AVCodec ff_dvbsub_encoder
uint8_t * data[4]
data+linesize for the bitmap of this subtitle.
Libavcodec external API header.
static int dvbsub_encode(AVCodecContext *avctx, uint8_t *outbuf, int buf_size, const AVSubtitle *h)
main external API structure.
#define xf(width, name, var, range_min, range_max, subs,...)
#define RGB_TO_V_CCIR(r1, g1, b1, shift)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
#define RGB_TO_Y_CCIR(r, g, b)