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 "encode.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
 
const AVCodec ff_targa_encoder
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 190 of file targaenc.c.

◆ VE

Definition at line 191 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 51 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 71 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 86 of file targaenc.c.

◆ targa_encode_init()

static av_cold int targa_encode_init ( AVCodecContext avctx)
static

Definition at line 180 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 192 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 198 of file targaenc.c.

◆ ff_targa_encoder

const 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[]){
},
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
}

Definition at line 205 of file targaenc.c.

FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:42
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
targa_class
static const AVClass targa_class
Definition: targaenc.c:198
OFFSET
#define OFFSET(x)
Definition: targaenc.c:190
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
rle
static int rle(uint8_t *dst, const uint8_t *src, int compressed_size, int uncompressed_size)
Definition: exr.c:215
init
static int init
Definition: av_tx.c:47
VE
#define VE
Definition: targaenc.c:191
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:296
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:180
TargaContext
Definition: targa.c:29
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
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:117
targa_encode_frame
static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
Definition: targaenc.c:86
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:224
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_CODEC_ID_TARGA
@ AV_CODEC_ID_TARGA
Definition: codec_id.h:143
options
static const AVOption options[]
Definition: targaenc.c:192