30 #define BITSTREAM_READER_LE
38 #define IVI4_PIC_SIZE_ESC 7
84 for (i = 0; i < 4; i++)
95 return size_factor == 15 ? def_size : (size_factor + 1) << 5;
107 int pic_size_indx, i, p;
137 ff_dlog(avctx,
"Null frame encountered!\n");
146 ff_dlog(avctx,
"Password-protected clip!\n");
183 av_log(avctx,
AV_LOG_ERROR,
"Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",
199 for (p = 0; p <= 2; p++) {
209 "Couldn't reallocate internal structures!\n");
239 ff_dlog(avctx,
"Pic hdr extension encountered!\n");
266 int plane, band_num, indx, transform_id, scan_indx;
318 if ((transform_id >= 7 && transform_id <= 9) ||
319 transform_id == 17) {
324 if (transform_id < 10 && band->blk_size < 8) {
328 if ((transform_id >= 0 && transform_id <= 2) || transform_id == 10)
335 if (transform_id < 10)
346 if (scan_indx == 15) {
350 if (scan_indx > 4 && scan_indx < 10) {
364 if (quant_mat == 31) {
375 if (old_blk_size != band->
blk_size) {
377 "The band block size does not match the configuration "
418 for (i = 0; i < band->
num_corr * 2; i++)
459 int x, y, mv_x, mv_y, mv_delta, offs, mb_offset, blks_per_mb,
590 if ( x + (mb->
mv_x >>s) + (y+ (mb->
mv_y >>s))*band->
pitch < 0 ||
619 int is_prev_ref = 0, is_ref = 0;
637 if (is_prev_ref && is_ref) {
639 }
else if (is_prev_ref) {
int is_empty
= 1 if this band doesn't contain any data
uint32_t data_size
size of the frame data in bytes from picture header
uint8_t type
macroblock type: 0 - INTRA, 1 - INTER
int num_MBs
number of macroblocks in this tile
static const uint16_t ivi4_quant_8x8_intra[9][64]
Indeo 4 dequant tables.
static int scale_tile_size(int def_size, int size_factor)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static av_always_inline void mv_scale(Mv *dst, Mv *src, int td, int tb)
This file contains data needed for the Indeo 4 decoder.
InvTransformPtr * inv_transform
#define IVI4_PIC_SIZE_ESC
static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
Decode Indeo 4 picture header.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
void ff_ivi_row_haar8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
one-dimensional inverse 8-point Haar transform on rows for Indeo 4
static int decode_plane_subdivision(GetBitContext *gb)
Decode subdivision of a plane.
int(* decode_pic_hdr)(struct IVI45DecContext *ctx, AVCodecContext *avctx)
static void skip_bits_long(GetBitContext *s, int n)
static av_cold int init(AVCodecContext *avctx)
int8_t b_mv_y
second motion vector (y component)
av_cold int ff_ivi_decode_close(AVCodecContext *avctx)
Close Indeo5 decoder and clean up its context.
int(* decode_mb_info)(struct IVI45DecContext *ctx, IVIBandDesc *band, IVITile *tile, AVCodecContext *avctx)
void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
DC-only inverse column slant transform.
#define IVI_VLC_BITS
max number of bits of the ivi's huffman codes
int dst_buf
buffer index for the currently decoded frame
int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
DSP functions (inverse transforms, motion compensations, wavelet recomposition) for Indeo Video Inter...
void ff_ivi_col_haar8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
one-dimensional inverse 8-point Haar transform on columns for Indeo 4
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int is_halfpel
precision of the motion compensation: 0 - fullpel, 1 - halfpel
int plane
plane number this band belongs to
int bufsize
band buffer size in bytes
void ff_ivi_row_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D row slant transform
void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
DC-only two-dimensional inverse slant transform.
int quant_mat
dequant matrix index
void( DCTransformPtr)(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
int8_t b_mv_x
second motion vector (x component)
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
ptrdiff_t pitch
pitch associated with the buffers above
VLC * tab
index of one of the predefined tables or "7" for custom one
void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
Copy the pixels into the frame buffer.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
const uint16_t * inter_base
quantization matrix for inter blocks
av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg, int is_indeo4)
Initialize planes (prepares descriptors, allocates buffers etc).
static const uint16_t ivi4_common_pic_sizes[14]
standard picture dimensions
void ff_ivi_inverse_haar_4x4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
two-dimensional inverse Haar 4x4 transform for Indeo 4
int inherit_mv
tells if motion vector is inherited from reference macroblock
static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band, AVCodecContext *avctx)
Decode Indeo 4 band header.
static const uint16_t ivi4_quant_8x8_inter[9][64]
uint8_t cbp
coded block pattern
void ff_ivi_col_slant4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D column slant transform
uint16_t checksum
frame checksum
bitstream reader API header.
void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
Copy the DC coefficient into the first pixel of the block and zero all others.
static const uint16_t ivi4_quant_4x4_inter[5][16]
IVIPlaneDesc planes[3]
color planes
const uint16_t * intra_base
quantization matrix for intra blocks
static int get_bits_left(GetBitContext *gb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint8_t corr[61 *2]
rvmap correction pairs
RVMapDesc rvmap_tabs[9]
local corrected copy of the static rvmap tables
void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
two-dimensional inverse Haar 8x8 transform for Indeo 4
void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
DC-only inverse row slant transform.
uint8_t in_q
flag for explicitly stored quantiser delta
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
av_cold int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height)
Initialize tile and macroblock descriptors.
DCTransformPtr * dc_trans
int ref_buf
inter frame reference buffer index
DCTransformPtr * dc_transform
This file contains structures and macros shared by both Indeo4 and Indeo5 decoders.
const char * name
Name of the codec implementation.
static int ivi_pic_config_cmp(IVIPicConfig *str1, IVIPicConfig *str2)
compare some properties of two pictures
int inherit_qdelta
tells if quantiser delta is inherited from reference macroblock
int(* decode_band_hdr)(struct IVI45DecContext *ctx, IVIBandDesc *band, AVCodecContext *avctx)
const RVMapDesc ff_ivi_rvmap_tabs[9]
Run-value (RLE) tables.
IVIMbInfo * mbs
array of macroblock descriptors
static void switch_buffers(IVI45DecContext *ctx)
Rearrange decoding and reference buffers.
const uint8_t * inter_scale
quantization coefficient for inter blocks
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
void ff_ivi_col_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D column slant transform
int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab, IVIHuffTab *huff_tab, AVCodecContext *avctx)
Decode a huffman codebook descriptor from the bitstream and select specified huffman table...
intra frame with slightly different bitstream coding
static const struct @73 transforms[18]
static const uint8_t *const scan_index_to_tab[15]
int8_t q_delta
quant delta
static const uint8_t quant_index_to_tab[22]
Table for mapping quant matrix index from the bitstream into internal quant table number...
#define FF_ARRAY_ELEMS(a)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
IVIHuffTab mb_vlc
current macroblock table descriptor
int is_2d_trans
1 indicates that the two-dimensional inverse transform is used
void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
DC-only two-dimensional inverse Haar transform for Indeo 4.
Libavcodec external API header.
int glob_quant
quant base for this band
void ff_ivi_row_haar4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
one-dimensional inverse 4-point Haar transform on rows for Indeo 4
main external API structure.
void ff_ivi_col_haar4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
one-dimensional inverse 4-point Haar transform on columns for Indeo 4
int num_corr
number of correction entries
static int ivi_scale_mv(int mv, int mv_scale)
scale motion vector
information for Indeo tile
int(* is_nonnull_frame)(struct IVI45DecContext *ctx)
static unsigned int get_bits1(GetBitContext *s)
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static void skip_bits(GetBitContext *s, int n)
static const uint16_t ivi4_quant_4x4_intra[5][16]
void(* switch_buffers)(struct IVI45DecContext *ctx)
IVIBandDesc * bands
array of band descriptors
void( InvTransformPtr)(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
Declare inverse transform function types.
int32_t checksum
for debug purposes
int rvmap_sel
rvmap table selector
int8_t mv_x
motion vector (x component)
int8_t mv_y
motion vector (y component)
#define IVI_TOSIGNED(val)
convert unsigned values into signed ones (the sign is in the LSB)
int mb_size
macroblock size
IVIMbInfo * ref_mbs
ptr to the macroblock descriptors of the reference tile
IVIHuffTab blk_vlc
current block table descriptor
void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
two-dimensional inverse slant 4x4 transform
InvTransformPtr * inv_trans
common internal api header.
static int is_nonnull_frame(IVI45DecContext *ctx)
void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
two-dimensional inverse slant 8x8 transform
static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band, IVITile *tile, AVCodecContext *avctx)
Decode information (block type, cbp, quant delta, motion vector) for all macroblocks in the current t...
const uint8_t * scan
ptr to the scan pattern
static av_cold int decode_init(AVCodecContext *avctx)
uint8_t has_transp
transparency mode status: 1 - enabled
VLC_TYPE(* table)[2]
code, bits
static const uint8_t * align_get_bits(GetBitContext *s)
int prev_frame_type
frame type of the previous frame
void ff_ivi_row_slant4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D row slant transform
information for Indeo macroblock (16x16, 8x8 or 4x4)
IVIHuffTab blk_vlc
vlc table for decoding block data
int scan_size
size of the scantable
av_cold void ff_ivi_init_static_vlc(void)
Initialize static codes used for macroblock and block decoding.
static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt)
const uint8_t * intra_scale
quantization coefficient for intra blocks
#define FFSWAP(type, a, b)
uint32_t buf_offs
address in the output buffer for this mb
int b_ref_buf
second reference frame buffer index
information for Indeo wavelet band
Huffman table is used for coding macroblocks.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
AVCodec ff_indeo4_decoder