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;
122 #if IVI4_STREAM_ANALYSER
124 ctx->has_b_frames = 1;
128 #if IVI4_STREAM_ANALYSER
144 ff_dlog(avctx,
"Null frame encountered!\n");
153 ff_dlog(avctx,
"Password-protected clip!\n");
169 #if IVI4_STREAM_ANALYSER
170 ctx->uses_tiling = 1;
192 av_log(avctx,
AV_LOG_ERROR,
"Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",
208 for (p = 0; p <= 2; p++) {
218 "Couldn't reallocate internal structures!\n");
248 ff_dlog(avctx,
"Pic hdr extension encountered!\n");
273 int plane, band_num, indx, transform_id, scan_indx;
298 #if IVI4_STREAM_ANALYSER
300 ctx->uses_fullpel = 1;
327 if ((transform_id >= 7 && transform_id <= 9) ||
328 transform_id == 17) {
333 if (transform_id < 10 && band->blk_size < 8) {
337 #if IVI4_STREAM_ANALYSER
338 if ((transform_id >= 0 && transform_id <= 2) || transform_id == 10)
346 if (transform_id < 10)
357 if (scan_indx == 15) {
361 if (scan_indx > 4 && scan_indx < 10) {
375 if (quant_mat == 31) {
386 if (old_blk_size != band->
blk_size) {
388 "The band block size does not match the configuration "
429 for (i = 0; i < band->
num_corr * 2; i++)
470 int x, y, mv_x, mv_y, mv_delta, offs, mb_offset, blks_per_mb,
601 if ( x + (mb->
mv_x >>s) + (y+ (mb->
mv_y >>s))*band->
pitch < 0 ||
630 int is_prev_ref = 0, is_ref = 0;
648 if (is_prev_ref && is_ref) {
650 }
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)
void ff_ivi_row_slant4(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
inverse 1D row slant transform
intra frame with slightly different bitstream coding
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void ff_ivi_col_slant4(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
inverse 1D column slant transform
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
void( DCTransformPtr)(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
#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.
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)
void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
DC-only two-dimensional inverse Haar transform for Indeo 4.
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)
#define IVI_VLC_BITS
max number of bits of the ivi's huffman codes
int dst_buf
buffer index for the currently decoded frame
void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
Copy the DC coefficient into the first pixel of the block and zero all others.
int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
DSP functions (inverse transforms, motion compensations, wavelet recompostion) for Indeo Video Intera...
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
int quant_mat
dequant matrix index
int8_t b_mv_x
second motion vector (x component)
void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
Copy the pixels into the frame buffer.
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
VLC * tab
index of one of the predefined tables or "7" for custom one
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Huffman table is used for coding macroblocks.
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
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.
void( InvTransformPtr)(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
Declare inverse transform function types.
int pitch
pitch associated with the buffers above
static const uint16_t ivi4_quant_8x8_inter[9][64]
uint8_t cbp
coded block pattern
void ff_ivi_row_haar8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
one-dimensional inverse 8-point Haar transform on rows for Indeo 4
uint16_t checksum
frame checksum
bitstream reader API header.
static const uint16_t ivi4_quant_4x4_inter[5][16]
IVIPlaneDesc planes[3]
color planes
void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
inverse 1D row slant transform
const uint16_t * intra_base
quantization matrix for intra blocks
void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
DC-only inverse row slant transform.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint8_t corr[61 *2]
rvmap correction pairs
void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
two-dimensional inverse Haar 8x8 transform for Indeo 4
RVMapDesc rvmap_tabs[9]
local corrected copy of the static rvmap tables
void ff_ivi_col_haar4(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
one-dimensional inverse 4-point Haar transform on columns for Indeo 4
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
void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
DC-only inverse column slant transform.
int ref_buf
inter frame reference buffer index
DCTransformPtr * dc_transform
This file contains structures and macros shared by both Indeo4 and Indeo5 decoders.
static const struct @58 transforms[18]
const char * name
Name of the codec implementation.
static int ivi_pic_config_cmp(IVIPicConfig *str1, IVIPicConfig *str2)
compare some properties of two pictures
void ff_ivi_inverse_haar_4x4(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
two-dimensional inverse Haar 4x4 transform for Indeo 4
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.
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...
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)
void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
two-dimensional inverse slant 8x8 transform
#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
Libavcodec external API header.
int glob_quant
quant base for this band
main external API structure.
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)
void ff_ivi_col_haar8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
one-dimensional inverse 8-point Haar transform on columns for Indeo 4
static const uint16_t ivi4_quant_4x4_intra[5][16]
void(* switch_buffers)(struct IVI45DecContext *ctx)
IVIBandDesc * bands
array of band descriptors
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, uint32_t pitch, const uint8_t *flags)
two-dimensional inverse slant 4x4 transform
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
InvTransformPtr * inv_trans
common internal api header.
static int is_nonnull_frame(IVI45DecContext *ctx)
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)
VLC_TYPE(* table)[2]
code, bits
int transp_status
transparency mode status: 1 - enabled
void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
DC-only two-dimensional inverse slant transform.
static const uint8_t * align_get_bits(GetBitContext *s)
int prev_frame_type
frame type of the previous frame
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.
void ff_ivi_row_haar4(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
one-dimensional inverse 4-point Haar transform on rows for Indeo 4
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
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
AVCodec ff_indeo4_decoder
void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
inverse 1D column slant transform