FFmpeg
Data Structures | Macros | Functions | Variables
targaenc.c File Reference
#include <string.h>
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "internal.h"
#include "rle.h"
#include "targa.h"

Go to the source code of this file.

Data Structures

struct  TargaContext
 

Macros

#define OFFSET(x)   offsetof(TargaContext, x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static int targa_encode_rle (uint8_t *outbuf, int out_size, const AVFrame *pic, int bpp, int w, int h)
 RLE compress the image, with maximum size of out_size. More...
 
static int targa_encode_normal (uint8_t *outbuf, const AVFrame *pic, int bpp, int w, int h)
 
static int targa_encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
 
static av_cold int targa_encode_init (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
static const AVClass targa_class
 
AVCodec ff_targa_encoder
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 204 of file targaenc.c.

◆ VE

Definition at line 205 of file targaenc.c.

Function Documentation

◆ targa_encode_rle()

static int targa_encode_rle ( uint8_t outbuf,
int  out_size,
const AVFrame pic,
int  bpp,
int  w,
int  h 
)
static

RLE compress the image, with maximum size of out_size.

Parameters
outbufOutput buffer
out_sizeMaximum output size
picImage to compress
bppBytes per pixel
wImage width
hImage height
Returns
Size of output in bytes, or -1 if larger than out_size

Definition at line 50 of file targaenc.c.

Referenced by targa_encode_frame().

◆ targa_encode_normal()

static int targa_encode_normal ( uint8_t outbuf,
const AVFrame pic,
int  bpp,
int  w,
int  h 
)
static

Definition at line 70 of file targaenc.c.

Referenced by targa_encode_frame().

◆ targa_encode_frame()

static int targa_encode_frame ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame p,
int got_packet 
)
static

Definition at line 85 of file targaenc.c.

◆ targa_encode_init()

static av_cold int targa_encode_init ( AVCodecContext avctx)
static

Definition at line 187 of file targaenc.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "rle", "Use run-length compression", OFFSET(rle), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
{ NULL },
}

Definition at line 206 of file targaenc.c.

◆ targa_class

const AVClass targa_class
static
Initial value:
= {
.class_name = "targa",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 212 of file targaenc.c.

◆ ff_targa_encoder

AVCodec ff_targa_encoder
Initial value:
= {
.name = "targa",
.long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"),
.priv_data_size = sizeof(TargaContext),
.priv_class = &targa_class,
.encode2 = targa_encode_frame,
.pix_fmts = (const enum AVPixelFormat[]){
},
}

Definition at line 219 of file targaenc.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
targa_class
static const AVClass targa_class
Definition: targaenc.c:212
OFFSET
#define OFFSET(x)
Definition: targaenc.c:204
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:95
VE
#define VE
Definition: targaenc.c:205
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:275
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
targa_encode_init
static av_cold int targa_encode_init(AVCodecContext *avctx)
Definition: targaenc.c:187
TargaContext
Definition: targa.c:29
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
targa_encode_frame
static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
Definition: targaenc.c:85
AV_PIX_FMT_RGB555LE
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:108
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_CODEC_ID_TARGA
@ AV_CODEC_ID_TARGA
Definition: avcodec.h:311
options
static const AVOption options[]
Definition: targaenc.c:206