FFmpeg
Classes | Macros | Typedefs | Enumerations | Variables
diracdec.c File Reference

Dirac Decoder. More...

#include "libavutil/pixdesc.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "get_bits.h"
#include "bytestream.h"
#include "internal.h"
#include "golomb.h"
#include "dirac_arith.h"
#include "dirac_vlc.h"
#include "mpeg12data.h"
#include "libavcodec/mpegvideo.h"
#include "mpegvideoencdsp.h"
#include "dirac_dwt.h"
#include "dirac.h"
#include "diractab.h"
#include "diracdsp.h"
#include "videodsp.h"

Classes

struct  DiracFrame
 
struct  DiracBlock
 
struct  SubBand
 
struct  Plane
 
struct  DiracSlice
 
struct  DiracContext
 
struct  SliceCoeffs
 

Macros

#define MAX_REFERENCE_FRAMES   8
 The spec limits this to 3 for frame coding, but in practice can be as high as 6.
 
#define MAX_DELAY   5 /* limit for main profile for frame coding (TODO: field coding) */
 
#define MAX_FRAMES   (MAX_REFERENCE_FRAMES + MAX_DELAY + 1)
 
#define MAX_QUANT   255 /* max quant for VC-2 */
 
#define MAX_BLOCKSIZE   32 /* maximum xblen/yblen we support */
 
#define DIRAC_REF_MASK_REF1   1
 DiracBlock->ref flags, if set then the block does MC from the given ref.
 
#define DIRAC_REF_MASK_REF2   2
 
#define DIRAC_REF_MASK_GLOBAL   4
 
#define DELAYED_PIC_REF   4
 Value of Picture.reference when Picture is not a reference picture, but is held for delayed output.
 
#define CALC_PADDING(size, depth)   (((size + (1 << depth) - 1) >> depth) << depth)
 
#define DIVRNDUP(a, b)   (((a) + (b) - 1) / (b))
 
#define SIGN_CTX(x)   (CTX_SIGN_ZERO + ((x) > 0) - ((x) < 0))
 
#define UNPACK_ARITH(n, type)
 
#define INTRA_DC_PRED(n, type)
 Dirac Specification -> 13.3 intra_dc_prediction(band) More...
 
#define PARSE_VALUES(type, x, gb, ebits, buf1, buf2)
 
#define CHECKEDREAD(dst, cond, errmsg)
 
#define ROLLOFF(i)
 
#define DATA_UNIT_HEADER_SIZE   13
 Dirac Specification -> 9.6 Parse Info Header Syntax. More...
 

Typedefs

typedef struct SubBand SubBand
 
typedef struct Plane Plane
 
typedef struct DiracSlice DiracSlice
 
typedef struct DiracContext DiracContext
 
typedef struct SliceCoeffs SliceCoeffs
 

Enumerations

enum  dirac_subband {
  subband_ll = 0, subband_hl = 1, subband_lh = 2, subband_hh = 3,
  subband_nb
}
 

Variables

AVCodec ff_dirac_decoder
 

Detailed Description

Dirac Decoder.

Author
Marco Gerards marco.nosp@m.@gnu.nosp@m..org, David Conrad, Jordi Ortiz nenjo.nosp@m.rdi@.nosp@m.gmail.nosp@m..com

Macro Definition Documentation

§ CHECKEDREAD

#define CHECKEDREAD (   dst,
  cond,
  errmsg 
)
Value:
tmp = get_interleaved_ue_golomb(gb); \
if (cond) { \
av_log(s->avctx, AV_LOG_ERROR, errmsg); \
}\
dst = tmp;
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176

§ DATA_UNIT_HEADER_SIZE

#define DATA_UNIT_HEADER_SIZE   13

Dirac Specification -> 9.6 Parse Info Header Syntax.

parse_info() 4 byte start code + byte parse code + 4 byte size + 4 byte previous size

§ INTRA_DC_PRED

#define INTRA_DC_PRED (   n,
  type 
)
Value:
static inline void intra_dc_prediction_##n(SubBand *b) \
{ \
type *buf = (type*)b->ibuf; \
int x, y; \
\
for (x = 1; x < b->width; x++) \
buf[x] += buf[x-1]; \
buf += (b->stride >> (1+b->pshift)); \
\
for (y = 1; y < b->height; y++) { \
buf[0] += buf[-(b->stride >> (1+b->pshift))]; \
\
for (x = 1; x < b->width; x++) { \
int pred = buf[x - 1] + buf[x - (b->stride >> (1+b->pshift))] + buf[x - (b->stride >> (1+b->pshift))-1]; \
buf[x] += divide3(pred); \
} \
buf += (b->stride >> (1+b->pshift)); \
} \
} \
Definition: cfhd.h:43

Dirac Specification -> 13.3 intra_dc_prediction(band)

§ PARSE_VALUES

#define PARSE_VALUES (   type,
  x,
  gb,
  ebits,
  buf1,
  buf2 
)
Value:
type *buf = (type *)buf1; \
buf[x] = coeff_unpack_golomb(gb, qfactor, qoffset); \
if (get_bits_count(gb) >= ebits) \
return; \
if (buf2) { \
buf = (type *)buf2; \
buf[x] = coeff_unpack_golomb(gb, qfactor, qoffset); \
if (get_bits_count(gb) >= ebits) \
return; \
} \

§ ROLLOFF

#define ROLLOFF (   i)
Value:
offset == 1 ? ((i) ? 5 : 3) : \
(1 + (6*(i) + offset - 1) / (2*offset - 1))

§ UNPACK_ARITH

#define UNPACK_ARITH (   n,
  type 
)
Value:
static inline void coeff_unpack_arith_##n(DiracArith *c, int qfactor, int qoffset, \
SubBand *b, type *buf, int x, int y) \
{ \
int sign, sign_pred = 0, pred_ctx = CTX_ZPZN_F1; \
unsigned coeff; \
const int mstride = -(b->stride >> (1+b->pshift)); \
if (b->parent) { \
const type *pbuf = (type *)b->parent->ibuf; \
const int stride = b->parent->stride >> (1+b->parent->pshift); \
pred_ctx += !!pbuf[stride * (y>>1) + (x>>1)] << 1; \
} \
if (b->orientation == subband_hl) \
sign_pred = buf[mstride]; \
if (x) { \
pred_ctx += !(buf[-1] | buf[mstride] | buf[-1 + mstride]); \
if (b->orientation == subband_lh) \
sign_pred = buf[-1]; \
} else { \
pred_ctx += !buf[mstride]; \
} \
coeff = dirac_get_arith_uint(c, pred_ctx, CTX_COEFF_DATA); \
if (coeff) { \
coeff = (coeff * qfactor + qoffset) >> 2; \
sign = dirac_get_arith_bit(c, SIGN_CTX(sign_pred)); \
coeff = (coeff ^ -sign) + sign; \
} \
*buf = coeff; \
} \
Definition: dirac_arith.h:75
Definition: cfhd.h:43

Variable Documentation

§ ff_dirac_decoder

AVCodec ff_dirac_decoder
Initial value:
= {
.name = "dirac",
.long_name = NULL_IF_CONFIG_SMALL("BBC Dirac VC-2"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_DIRAC,
.priv_data_size = sizeof(DiracContext),
.init = dirac_decode_init,
.close = dirac_decode_end,
.decode = dirac_decode_frame,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
.flush = dirac_decode_flush,
}
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: avcodec.h:984
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:40
Definition: diracdec.c:134
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition: avcodec.h:1019
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:959