43 int bpp,
int w,
int h)
50 for(y = 0; y < h; y ++) {
65 uint8_t *out = outbuf;
66 uint8_t *ptr = pic->
data[0];
68 for(i=0; i < h; i++) {
78 unsigned char *outbuf,
79 int buf_size,
void *
data){
81 int bpp, picsize, datasize = -1;
84 if(avctx->
width > 0xffff || avctx->
height > 0xffff) {
89 if(buf_size < picsize + 45) {
98 memset(outbuf, 0, 12);
126 bpp = outbuf[16] >> 3;
146 memcpy(out,
"\0\0\0\0\0\0\0\0TRUEVISION-XFILE.", 26);
148 return out + 26 - outbuf;
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
AVFrame * coded_frame
the picture in the bitstream
targa file common definitions
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
static int targa_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int buf_size, void *data)
int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height)
Calculate the size in bytes that a picture of the given width and height would occupy if stored in th...
struct TargaContext TargaContext
static int init(AVCodecParserContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int width
picture width / height.
const char * av_get_pix_fmt_name(enum PixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 ...
packed RGB 8:8:8, 24bpp, BGRBGR...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define FF_CODER_TYPE_RAW
static int targa_encode_normal(uint8_t *outbuf, AVFrame *pic, int bpp, int w, int h)
static av_cold int targa_encode_init(AVCodecContext *avctx)
int key_frame
1 -> keyframe, 0-> not
void avcodec_get_frame_defaults(AVFrame *pic)
Set the fields of the given AVFrame to default values.
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.
static int targa_encode_rle(uint8_t *outbuf, int out_size, AVFrame *pic, int bpp, int w, int h)
RLE compress the image, with maximum size of out_size.