FFmpeg
Loading...
Searching...
No Matches
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)
 
#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.
 
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)
Value:
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 },
}
#define VE
Definition amfenc_av1.c:30
#define NULL
Definition coverity.c:32
static int rle(uint8_t *dst, const uint8_t *src, int compressed_size, int uncompressed_size)
Definition exr.c:217
#define OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258

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,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85

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,
}
#define CODEC_PIXFMTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#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:147
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
@ AV_CODEC_ID_TARGA
Definition codec_id.h:143
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition pixfmt.h:102
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ 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
8 bits with AV_PIX_FMT_RGB32 palette
Definition pixfmt.h:84
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition pixfmt.h:76
static const AVClass targa_class
Definition targaenc.c:201
static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
Definition targaenc.c:87
static av_cold int targa_encode_init(AVCodecContext *avctx)
Definition targaenc.c:183

Definition at line 208 of file targaenc.c.