53 int bpp,
int w,
int h)
60 for(y = 0; y <
h; y ++) {
75 uint8_t *
out = outbuf;
76 const uint8_t *ptr = pic->
data[0];
78 for(
i=0;
i <
h;
i++) {
88 const AVFrame *p,
int *got_packet)
91 int bpp, picsize, datasize = -1, ret,
i;
101 memset(
pkt->data, 0, 12);
113 for (
i = 0;
i < 256;
i++)
114 if (
AV_RN32(p->data[1] + 4 *
i) >> 24 != 0xFF) {
121 pkt->data[7] = pal_bpp;
123 for (
i = 0;
i < 256;
i++)
125 AV_WL32(
pkt->data + 18 + 4 *
i, *(uint32_t *)(p->data[1] +
i * 4));
127 AV_WL24(
pkt->data + 18 + 3 *
i, *(uint32_t *)(p->data[1] +
i * 4));
156 bpp =
pkt->data[16] >> 3;
175 memcpy(
out,
"\0\0\0\0\0\0\0\0TRUEVISION-XFILE.", 26);
185 if (avctx->
width > 0xffff || avctx->
height > 0xffff) {
193#define OFFSET(x) offsetof(TargaContext, x)
194#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
202 .class_name =
"targa",
const FFCodec ff_targa_encoder
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define CODEC_PIXFMTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and allocate data.
static int rle(uint8_t *dst, const uint8_t *src, int compressed_size, int uncompressed_size)
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align)
Return the size in bytes of the amount of data required to store an image with the given parameters.
#define LIBAVUTIL_VERSION_INT
common internal API header
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
int ff_rle_encode(uint8_t *outbuf, int out_size, const uint8_t *ptr, int bpp, int w, int add_rep, int xor_rep, int add_raw, int xor_raw)
RLE compress the row, with maximum size of out_size.
Describe the class of an AVClass context structure.
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
This structure stores compressed data.
targa file common definitions
static int targa_encode_normal(uint8_t *outbuf, const AVFrame *pic, int bpp, int w, int h)
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 const AVClass targa_class
static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
static av_cold int targa_encode_init(AVCodecContext *avctx)