libavcodec/tiffenc.c File Reference

TIFF image encoder. More...

#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
#include "bytestream.h"
#include "tiff.h"
#include "rle.h"
#include "lzw.h"
#include "put_bits.h"

Go to the source code of this file.

Data Structures

struct  TiffEncoderContext

Defines

#define TIFF_MAX_ENTRY   32
#define OFFSET(x)   offsetof(TiffEncoderContext, x)
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM

Functions

static int check_size (TiffEncoderContext *s, uint64_t need)
 Check free space in buffer.
static void tnput (uint8_t **p, int n, const uint8_t *val, enum TiffTypes type, int flip)
 Put n values to buffer.
static void add_entry (TiffEncoderContext *s, enum TiffTags tag, enum TiffTypes type, int count, const void *ptr_val)
 Add entry to directory in tiff header.
static void add_entry1 (TiffEncoderContext *s, enum TiffTags tag, enum TiffTypes type, int val)
static int encode_strip (TiffEncoderContext *s, const int8_t *src, uint8_t *dst, int n, int compr)
 Encode one strip in tiff file.
static void pack_yuv (TiffEncoderContext *s, uint8_t *dst, int lnum)
static int encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)

Variables

static const uint8_t type_sizes2 [6]
 sizes of various TIFF field types (string size = 1)
static const AVOption options []
static const AVClass tiffenc_class
AVCodec ff_tiff_encoder


Detailed Description

TIFF image encoder.

Author:
Bartlomiej Wolowiec

Definition in file tiffenc.c.


Define Documentation

#define OFFSET (  )     offsetof(TiffEncoderContext, x)

Definition at line 483 of file tiffenc.c.

#define TIFF_MAX_ENTRY   32

Definition at line 43 of file tiffenc.c.

Referenced by add_entry().

#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM

Definition at line 484 of file tiffenc.c.


Function Documentation

static void add_entry ( TiffEncoderContext s,
enum TiffTags  tag,
enum TiffTypes  type,
int  count,
const void *  ptr_val 
) [static]

Add entry to directory in tiff header.

Parameters:
s Tiff context
tag Tag that identifies the entry
type Entry type
count The number of values
ptr_val Pointer to values

Definition at line 118 of file tiffenc.c.

Referenced by add_entry1(), and encode_frame().

static void add_entry1 ( TiffEncoderContext s,
enum TiffTags  tag,
enum TiffTypes  type,
int  val 
) [static]

Definition at line 141 of file tiffenc.c.

Referenced by encode_frame().

static int check_size ( TiffEncoderContext s,
uint64_t  need 
) [inline, static]

Check free space in buffer.

Parameters:
s Tiff context
need Needed bytes
Returns:
0 - ok, 1 - no free space

Definition at line 80 of file tiffenc.c.

Referenced by add_entry(), encode_frame(), and encode_strip().

static int encode_frame ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame pict,
int *  got_packet 
) [static]

according to CCIR Recommendation 601.1

Definition at line 217 of file tiffenc.c.

static int encode_strip ( TiffEncoderContext s,
const int8_t *  src,
uint8_t dst,
int  n,
int  compr 
) [static]

Encode one strip in tiff file.

Parameters:
s Tiff context
src Input buffer
dst Output buffer
n Size of input buffer
compr Compression method
Returns:
Number of output bytes. If an output error is encountered, -1 returned

Definition at line 158 of file tiffenc.c.

Referenced by encode_frame().

static void pack_yuv ( TiffEncoderContext s,
uint8_t dst,
int  lnum 
) [static]

Definition at line 189 of file tiffenc.c.

Referenced by encode_frame().

static void tnput ( uint8_t **  p,
int  n,
const uint8_t val,
enum TiffTypes  type,
int  flip 
) [static]

Put n values to buffer.

Parameters:
p Pointer to pointer to output buffer
n Number of values
val Pointer to values
type Type of values
flip =0 - normal copy, >0 - flip

Definition at line 99 of file tiffenc.c.

Referenced by add_entry().


Variable Documentation

Initial value:

Definition at line 504 of file tiffenc.c.

const AVOption options[] [static]

Initial value:

 {
    {"dpi", "set the image resolution (in dpi)", OFFSET(dpi), AV_OPT_TYPE_INT, {.dbl = 72}, 1, 0x10000, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_ENCODING_PARAM},
    { "compression_algo", NULL, OFFSET(compr), AV_OPT_TYPE_INT, {TIFF_PACKBITS}, TIFF_RAW, TIFF_DEFLATE, VE, "compression_algo" },
    { "packbits", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_PACKBITS}, 0, 0, VE, "compression_algo" },
    { "raw",      NULL, 0, AV_OPT_TYPE_CONST, {TIFF_RAW},      0, 0, VE, "compression_algo" },
    { "lzw",      NULL, 0, AV_OPT_TYPE_CONST, {TIFF_LZW},      0, 0, VE, "compression_algo" },



    { NULL },
}

Definition at line 485 of file tiffenc.c.

const AVClass tiffenc_class [static]

Initial value:

 {
    .class_name = "TIFF encoder",
    .item_name  = av_default_item_name,
    .option     = options,
    .version    = LIBAVUTIL_VERSION_INT,
}

Definition at line 497 of file tiffenc.c.

const uint8_t type_sizes2[6] [static]

Initial value:

 {
    0, 1, 1, 2, 4, 8
}
sizes of various TIFF field types (string size = 1)

Definition at line 46 of file tiffenc.c.

Referenced by add_entry(), and tnput().


Generated on Fri Oct 26 02:47:59 2012 for FFmpeg by  doxygen 1.5.8