FFmpeg
Data Structures | Macros | Functions | Variables
targaenc.c File Reference
#include <string.h>
#include "libavutil/avassert.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 "codec_internal.h"
#include "encode.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 FFCodec ff_targa_encoder
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 193 of file targaenc.c.

◆ VE

Definition at line 194 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 52 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 72 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 87 of file targaenc.c.

◆ targa_encode_init()

static av_cold int targa_encode_init ( AVCodecContext avctx)
static

Definition at line 183 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 195 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 201 of file targaenc.c.

◆ ff_targa_encoder

const FFCodec ff_targa_encoder
Initial value:
= {
.p.name = "targa",
CODEC_LONG_NAME("Truevision Targa image"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(TargaContext),
.p.priv_class = &targa_class,
.p.pix_fmts = (const enum AVPixelFormat[]){
},
}

Definition at line 208 of file targaenc.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
targa_class
static const AVClass targa_class
Definition: targaenc.c:201
OFFSET
#define OFFSET(x)
Definition: targaenc.c:193
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:76
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:102
rle
static int rle(uint8_t *dst, const uint8_t *src, int compressed_size, int uncompressed_size)
Definition: exr.c:217
VE
#define VE
Definition: targaenc.c:194
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:320
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition: codec.h:159
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h: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:183
TargaContext
Definition: targa.c:28
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
targa_encode_frame
static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
Definition: targaenc.c:87
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:115
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:84
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_CODEC_ID_TARGA
@ AV_CODEC_ID_TARGA
Definition: codec_id.h:145
options
static const AVOption options[]
Definition: targaenc.c:195