FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
dvdsubenc.c File Reference
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include "libavutil/avassert.h"
#include "libavutil/bprint.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  DVDSubtitleContext
 

Macros

#define PUTNIBBLE(val)
 
#define OFFSET(x)   offsetof(DVDSubtitleContext, x)
 
#define SE   AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static void dvd_encode_rle (uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int h, const int cmap[256])
 
static int color_distance (uint32_t a, uint32_t b)
 
static void count_colors (AVCodecContext *avctx, unsigned hits[33], const AVSubtitleRect *r)
 Count colors used in a rectangle, quantizing alpha and grouping by nearest global palette entry. More...
 
static void select_palette (AVCodecContext *avctx, int out_palette[4], int out_alpha[4], unsigned hits[33])
 
static void build_color_map (AVCodecContext *avctx, int cmap[], const uint32_t palette[], const int out_palette[], unsigned int const out_alpha[])
 
static void copy_rectangle (AVSubtitleRect *dst, AVSubtitleRect *src, int cmap[])
 
static int encode_dvd_subtitles (AVCodecContext *avctx, uint8_t *outbuf, int outbuf_size, const AVSubtitle *h)
 
static int dvdsub_init (AVCodecContext *avctx)
 
static int dvdsub_encode (AVCodecContext *avctx, unsigned char *buf, int buf_size, const AVSubtitle *sub)
 

Variables

static const AVOption options []
 
static const AVClass dvdsubenc_class
 
AVCodec ff_dvdsub_encoder
 

Macro Definition Documentation

#define PUTNIBBLE (   val)
Value:
do {\
if (ncnt++ & 1)\
*q++ = bitbuf | ((val) & 0x0f);\
else\
bitbuf = (val) << 4;\
} while(0)
const char const char void * val
Definition: avisynth_c.h:771
if(ret< 0)
Definition: vf_mcdeint.c:282

Definition at line 36 of file dvdsubenc.c.

Referenced by dvd_encode_rle().

#define OFFSET (   x)    offsetof(DVDSubtitleContext, x)

Definition at line 467 of file dvdsubenc.c.

Definition at line 468 of file dvdsubenc.c.

Referenced by evolve().

Function Documentation

static void dvd_encode_rle ( uint8_t **  pq,
const uint8_t bitmap,
int  linesize,
int  w,
int  h,
const int  cmap[256] 
)
static

Definition at line 44 of file dvdsubenc.c.

Referenced by encode_dvd_subtitles().

static int color_distance ( uint32_t  a,
uint32_t  b 
)
static

Definition at line 97 of file dvdsubenc.c.

Referenced by build_color_map(), count_colors(), and select_palette().

static void count_colors ( AVCodecContext avctx,
unsigned  hits[33],
const AVSubtitleRect r 
)
static

Count colors used in a rectangle, quantizing alpha and grouping by nearest global palette entry.

Definition at line 116 of file dvdsubenc.c.

Referenced by encode_dvd_subtitles().

static void select_palette ( AVCodecContext avctx,
int  out_palette[4],
int  out_alpha[4],
unsigned  hits[33] 
)
static

Definition at line 153 of file dvdsubenc.c.

Referenced by encode_dvd_subtitles().

static void build_color_map ( AVCodecContext avctx,
int  cmap[],
const uint32_t  palette[],
const int  out_palette[],
unsigned int const  out_alpha[] 
)
static

Definition at line 211 of file dvdsubenc.c.

Referenced by encode_dvd_subtitles().

static void copy_rectangle ( AVSubtitleRect dst,
AVSubtitleRect src,
int  cmap[] 
)
static

Definition at line 234 of file dvdsubenc.c.

Referenced by encode_dvd_subtitles().

static int encode_dvd_subtitles ( AVCodecContext avctx,
uint8_t outbuf,
int  outbuf_size,
const AVSubtitle h 
)
static

Definition at line 250 of file dvdsubenc.c.

Referenced by dvdsub_encode().

static int dvdsub_init ( AVCodecContext avctx)
static

Definition at line 426 of file dvdsubenc.c.

static int dvdsub_encode ( AVCodecContext avctx,
unsigned char *  buf,
int  buf_size,
const AVSubtitle sub 
)
static

Definition at line 456 of file dvdsubenc.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{"even_rows_fix", "Make number of rows even (workaround for some players)", OFFSET(even_rows_fix), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, SE},
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define SE
Definition: dvdsubenc.c:468
#define OFFSET(x)
Definition: dvdsubenc.c:467

Definition at line 469 of file dvdsubenc.c.

const AVClass dvdsubenc_class
static
Initial value:
= {
.class_name = "VOBSUB subtitle encoder",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
av_default_item_name
static const AVOption options[]
Definition: dvdsubenc.c:469

Definition at line 474 of file dvdsubenc.c.

AVCodec ff_dvdsub_encoder
Initial value:
= {
.name = "dvdsub",
.long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"),
.init = dvdsub_init,
.encode_sub = dvdsub_encode,
.priv_class = &dvdsubenc_class,
.priv_data_size = sizeof(DVDSubtitleContext),
}
static const AVClass dvdsubenc_class
Definition: dvdsubenc.c:474
static int dvdsub_encode(AVCodecContext *avctx, unsigned char *buf, int buf_size, const AVSubtitle *sub)
Definition: dvdsubenc.c:456
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static int dvdsub_init(AVCodecContext *avctx)
Definition: dvdsubenc.c:426

Definition at line 481 of file dvdsubenc.c.