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 dependency graph for dvdsubenc.c:

Go to the source code of this file.

Data Structures

struct  DVDSubtitleContext
 

Macros

#define PUTNIBBLE(val)
 

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

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)
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks

Definition at line 33 of file dvdsubenc.c.

Referenced by dvd_encode_rle().

Function Documentation

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 208 of file dvdsubenc.c.

Referenced by encode_dvd_subtitles().

static int color_distance ( uint32_t  a,
uint32_t  b 
)
static

Definition at line 94 of file dvdsubenc.c.

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

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

Definition at line 231 of file dvdsubenc.c.

Referenced by encode_dvd_subtitles().

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 113 of file dvdsubenc.c.

Referenced by encode_dvd_subtitles().

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 41 of file dvdsubenc.c.

Referenced by encode_dvd_subtitles().

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

Definition at line 424 of file dvdsubenc.c.

static int dvdsub_init ( AVCodecContext avctx)
static

Definition at line 394 of file dvdsubenc.c.

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

Definition at line 247 of file dvdsubenc.c.

Referenced by dvdsub_encode().

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

Definition at line 150 of file dvdsubenc.c.

Referenced by encode_dvd_subtitles().

Variable Documentation

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

Definition at line 435 of file dvdsubenc.c.