tiff.c File Reference

TIFF image decoder. More...

#include "avcodec.h"
#include "bytestream.h"
#include "config.h"
#include "lzw.h"
#include "tiff.h"
#include "tiff_data.h"
#include "faxcompr.h"
#include "internal.h"
#include "mathops.h"
#include "libavutil/attributes.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "libavutil/avstring.h"
Include dependency graph for tiff.c:

Go to the source code of this file.

Data Structures

struct  TiffContext
 

Macros

#define RET_GEOKEY(TYPE, array, element)
 
#define RET_GEOKEY_VAL(TYPE, array)
 
#define ADD_METADATA(count, name, sep)
 

Typedefs

typedef struct TiffContext TiffContext
 

Functions

static unsigned tget_short (GetByteContext *gb, int le)
 
static unsigned tget_long (GetByteContext *gb, int le)
 
static double tget_double (GetByteContext *gb, int le)
 
static unsigned tget (GetByteContext *gb, int type, int le)
 
static void free_geotags (TiffContext *const s)
 
static const char * get_geokey_name (int key)
 
static int get_geokey_type (int key)
 
static int cmp_id_key (const void *id, const void *k)
 
static const char * search_keyval (const TiffGeoTagKeyName *keys, int n, int id)
 
static char * get_geokey_val (int key, int val)
 
static char * doubles2str (double *dp, int count, const char *sep)
 
static char * shorts2str (int16_t *sp, int count, const char *sep)
 
static int add_doubles_metadata (int count, const char *name, const char *sep, TiffContext *s, AVFrame *frame)
 
static int add_shorts_metadata (int count, const char *name, const char *sep, TiffContext *s, AVFrame *frame)
 
static int add_string_metadata (int count, const char *name, TiffContext *s, AVFrame *frame)
 
static int add_metadata (int count, int type, const char *name, const char *sep, TiffContext *s, AVFrame *frame)
 
static void av_always_inline horizontal_fill (unsigned int bpp, uint8_t *dst, int usePtr, const uint8_t *src, uint8_t c, int width, int offset)
 
static int tiff_unpack_strip (TiffContext *s, uint8_t *dst, int stride, const uint8_t *src, int size, int lines)
 
static int init_image (TiffContext *s, AVFrame *frame)
 
static int tiff_decode_tag (TiffContext *s, AVFrame *frame)
 
static int decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold int tiff_init (AVCodecContext *avctx)
 
static av_cold int tiff_end (AVCodecContext *avctx)
 

Variables

AVCodec ff_tiff_decoder
 

Detailed Description

TIFF image decoder.

Author
Konstantin Shishkov

Definition in file tiff.c.

Macro Definition Documentation

#define ADD_METADATA (   count,
  name,
  sep 
)
Value:
if ((ret = add_metadata(count, type, name, sep, s, frame)) < 0) {\
av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");\
}
const char * name
Definition: avisynth_c.h:675
const char * s
Definition: avisynth_c.h:668
static int add_metadata(int count, int type, const char *name, const char *sep, TiffContext *s, AVFrame *frame)
Definition: tiff.c:340
frame
Definition: stft.m:14
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:246
ret
Definition: avfilter.c:821
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:148
#define type
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame This method is called when a frame is wanted on an output For an it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return it should return
void INT64 INT64 count
Definition: avisynth_c.h:594

Referenced by tiff_decode_tag().

#define RET_GEOKEY (   TYPE,
  array,
  element 
)
Value:
if (key >= TIFF_##TYPE##_KEY_ID_OFFSET &&\
key - TIFF_##TYPE##_KEY_ID_OFFSET < FF_ARRAY_ELEMS(ff_tiff_##array##_name_type_map))\
return ff_tiff_##array##_name_type_map[key - TIFF_##TYPE##_KEY_ID_OFFSET].element;
#define FF_ARRAY_ELEMS(a)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame This method is called when a frame is wanted on an output For an it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return it should return

Definition at line 109 of file tiff.c.

Referenced by get_geokey_name(), and get_geokey_type().

#define RET_GEOKEY_VAL (   TYPE,
  array 
)
Value:
if (val >= TIFF_##TYPE##_OFFSET &&\
val - TIFF_##TYPE##_OFFSET < FF_ARRAY_ELEMS(ff_tiff_##array##_codes))\
return av_strdup(ff_tiff_##array##_codes[val - TIFF_##TYPE##_OFFSET]);
#define FF_ARRAY_ELEMS(a)
char * av_strdup(const char *s)
Duplicate the string s.
Definition: mem.c:220
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame This method is called when a frame is wanted on an output For an it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return it should return

Referenced by get_geokey_val().

Typedef Documentation

typedef struct TiffContext TiffContext

Function Documentation

static int add_doubles_metadata ( int  count,
const char *  name,
const char *  sep,
TiffContext s,
AVFrame frame 
)
static

Definition at line 268 of file tiff.c.

Referenced by add_metadata().

static int add_metadata ( int  count,
int  type,
const char *  name,
const char *  sep,
TiffContext s,
AVFrame frame 
)
static

Definition at line 340 of file tiff.c.

static int add_shorts_metadata ( int  count,
const char *  name,
const char *  sep,
TiffContext s,
AVFrame frame 
)
static

Definition at line 295 of file tiff.c.

Referenced by add_metadata().

static int add_string_metadata ( int  count,
const char *  name,
TiffContext s,
AVFrame frame 
)
static

Definition at line 321 of file tiff.c.

Referenced by add_metadata().

static int cmp_id_key ( const void id,
const void k 
)
static

Definition at line 134 of file tiff.c.

Referenced by search_keyval().

static int decode_frame ( AVCodecContext avctx,
void data,
int *  got_frame,
AVPacket avpkt 
)
static

Definition at line 1035 of file tiff.c.

static char* doubles2str ( double *  dp,
int  count,
const char *  sep 
)
static

Definition at line 216 of file tiff.c.

Referenced by add_doubles_metadata(), and tiff_decode_tag().

static void free_geotags ( TiffContext *const  s)
static

Definition at line 99 of file tiff.c.

Referenced by decode_frame(), and tiff_end().

static const char* get_geokey_name ( int  key)
static

Definition at line 114 of file tiff.c.

Referenced by decode_frame().

static int get_geokey_type ( int  key)
static

Definition at line 124 of file tiff.c.

Referenced by decode_frame().

static char* get_geokey_val ( int  key,
int  val 
)
static

Definition at line 148 of file tiff.c.

Referenced by tiff_decode_tag().

static void av_always_inline horizontal_fill ( unsigned int  bpp,
uint8_t dst,
int  usePtr,
const uint8_t src,
uint8_t  c,
int  width,
int  offset 
)
static

Definition at line 374 of file tiff.c.

Referenced by tiff_unpack_strip().

static int init_image ( TiffContext s,
AVFrame frame 
)
static

Definition at line 599 of file tiff.c.

Referenced by decode_frame().

static const char* search_keyval ( const TiffGeoTagKeyName keys,
int  n,
int  id 
)
static

Definition at line 139 of file tiff.c.

Referenced by get_geokey_val().

static char* shorts2str ( int16_t *  sp,
int  count,
const char *  sep 
)
static

Definition at line 242 of file tiff.c.

Referenced by add_shorts_metadata().

static unsigned tget ( GetByteContext gb,
int  type,
int  le 
)
static

Definition at line 89 of file tiff.c.

Referenced by decode_frame(), and tiff_decode_tag().

static double tget_double ( GetByteContext gb,
int  le 
)
static

Definition at line 83 of file tiff.c.

Referenced by add_doubles_metadata(), and tiff_decode_tag().

static unsigned tget_long ( GetByteContext gb,
int  le 
)
static

Definition at line 77 of file tiff.c.

Referenced by decode_frame(), tget(), and tiff_decode_tag().

static unsigned tget_short ( GetByteContext gb,
int  le 
)
static

Definition at line 71 of file tiff.c.

Referenced by add_shorts_metadata(), decode_frame(), tget(), and tiff_decode_tag().

static int tiff_decode_tag ( TiffContext s,
AVFrame frame 
)
static

Definition at line 659 of file tiff.c.

Referenced by decode_frame().

static av_cold int tiff_end ( AVCodecContext avctx)
static

Definition at line 1216 of file tiff.c.

static av_cold int tiff_init ( AVCodecContext avctx)
static

Definition at line 1203 of file tiff.c.

static int tiff_unpack_strip ( TiffContext s,
uint8_t dst,
int  stride,
const uint8_t src,
int  size,
int  lines 
)
static

Definition at line 414 of file tiff.c.

Referenced by decode_frame().

Variable Documentation

AVCodec ff_tiff_decoder
Initial value:
= {
.name = "tiff",
.priv_data_size = sizeof(TiffContext),
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: tiff.c:1035
static av_cold int tiff_init(AVCodecContext *avctx)
Definition: tiff.c:1203
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
struct TiffContext TiffContext
static av_cold int tiff_end(AVCodecContext *avctx)
Definition: tiff.c:1216
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:375
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: crystalhd.c:868

Definition at line 1227 of file tiff.c.