30 #define BITSTREAM_READER_LE
48 #define IVI5_PIC_SIZE_ESC 15
61 int result, i, p, tile_size, pic_size_indx, mb_size, blk_size, is_scalable;
62 int quant_mat, blk_size_changed = 0;
74 if (tile_size > 256) {
85 av_log(avctx,
AV_LOG_ERROR,
"Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",
123 blk_size_changed = 1;
126 for (p = 0; p <= 1; p++) {
134 mb_size = blk_size << !mb_size;
136 if (p==0 && blk_size==4) {
141 blk_size_changed = mb_size != band->
mb_size || blk_size != band->
blk_size;
142 if (blk_size_changed) {
153 switch ((p << 2) + i) {
200 quant_mat = (pic_conf.
luma_bands > 1) ? i+1 : 0;
250 if (blk_size_changed) {
255 "Couldn't reallocate internal structures!\n");
278 }
while (i & 0x8000);
389 if (band_flags & 1) {
403 if (band_flags & 0x10) {
412 for (i = 0; i < band->
num_corr * 2; i++)
432 if (band_flags & 0x20) {
456 int x, y, mv_x, mv_y, mv_delta, offs, mb_offset,
565 if ( x + (mb->
mv_x >>s) + (y+ (mb->
mv_y >>s))*band->
pitch < 0 ||
static const uint8_t ivi5_scale_quant_8x8_inter[5][24]
int is_empty
= 1 if this band doesn't contain any data
const uint8_t ff_ivi_direct_scan_4x4[16]
uint8_t type
macroblock type: 0 - INTRA, 1 - INTER
int num_MBs
number of macroblocks in this tile
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static const uint16_t ivi5_base_quant_4x4_inter[16]
static av_always_inline void mv_scale(Mv *dst, Mv *src, int td, int tb)
InvTransformPtr * inv_transform
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
int(* decode_pic_hdr)(struct IVI45DecContext *ctx, AVCodecContext *avctx)
static void skip_bits_long(GetBitContext *s, int n)
int inter_scal
signals a sequence of scalable inter frames
static av_cold int init(AVCodecContext *avctx)
static const uint16_t ivi5_base_quant_4x4_intra[16]
#define IVI_MBs_PER_TILE(tile_width, tile_height, mb_size)
calculate number of macroblocks in a tile
Huffman table is used for coding macroblocks.
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
static const uint8_t ivi5_common_pic_sizes[30]
standard picture dimensions (width, height divided by 4)
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...
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.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band, IVITile *tile, AVCodecContext *avctx)
Decode info (block type, cbp, quant delta, motion vector) for all macroblocks in the current tile...
static av_cold int decode_init(AVCodecContext *avctx)
Initialize Indeo5 decoder.
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.
const uint16_t * inter_base
quantization matrix for inter blocks
static const uint16_t ivi5_base_quant_8x8_intra[5][64]
static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
Decode Indeo5 GOP (Group of pictures) header.
int inherit_mv
tells if motion vector is inherited from reference macroblock
const uint8_t ff_ivi_vertical_scan_8x8[64]
Scan patterns shared between indeo4 and indeo5.
uint8_t cbp
coded block pattern
int qdelta_present
tells if Qdelta signal is present in the bitstream (Indeo5 only)
#define IVI5_IS_PROTECTED
uint16_t checksum
frame checksum
bitstream reader API header.
uint32_t pic_hdr_size
picture header size in bytes
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.
IVIPlaneDesc planes[3]
color planes
const uint16_t * intra_base
quantization matrix for intra blocks
int data_size
size of the band data
static int get_bits_left(GetBitContext *gb)
static int is_nonnull_frame(IVI45DecContext *ctx)
#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_dc_row_slant(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
DC-only inverse row slant transform.
AVCodec ff_indeo5_decoder
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const uint16_t ivi5_base_quant_8x8_inter[5][64]
Indeo5 dequantization matrixes consist of two tables: base table and scale table. ...
av_cold int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height)
Initialize tile and macroblock descriptors.
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
static const uint8_t ivi5_scale_quant_8x8_intra[5][24]
#define IVI5_PIC_SIZE_ESC
int inherit_qdelta
tells if quantiser delta is inherited from reference macroblock
int(* decode_band_hdr)(struct IVI45DecContext *ctx, IVIBandDesc *band, AVCodecContext *avctx)
const uint8_t ff_ivi_horizontal_scan_8x8[64]
const RVMapDesc ff_ivi_rvmap_tabs[9]
Run-value (RLE) tables.
This file contains data needed for the Indeo5 decoder.
int width
picture width / height.
IVIMbInfo * mbs
array of macroblock descriptors
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...
int8_t q_delta
quant delta
#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
av_cold int ff_ivi_init_planes(AVCodecContext *avctx, IVIPlaneDesc *planes, const IVIPicConfig *cfg, int is_indeo4)
Initialize planes (prepares descriptors, allocates buffers etc).
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)
int buf_switch
used to switch between three buffers
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 int skip_hdr_extension(GetBitContext *gb)
Skip a header extension.
static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
Decode Indeo5 picture header.
const uint8_t ff_zigzag_direct[64]
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)
static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band, AVCodecContext *avctx)
Decode Indeo5 band header.
#define IVI_TOSIGNED(val)
convert unsigned values into signed ones (the sign is in the LSB)
int mb_size
macroblock size
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
IVIMbInfo * ref_mbs
ptr to the macroblock descriptors of the reference tile
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
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
static const uint8_t ivi5_scale_quant_4x4_inter[24]
int ref2_buf
temporal storage for switching buffers
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
const uint8_t * scan
ptr to the scan pattern
static const uint8_t ivi5_scale_quant_4x4_intra[24]
VLC_TYPE(* table)[2]
code, bits
static const uint8_t * align_get_bits(GetBitContext *s)
static void switch_buffers(IVI45DecContext *ctx)
Switch buffers.
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
av_cold void ff_ivi_init_static_vlc(void)
Initialize static codes used for macroblock and block decoding.
const uint8_t * intra_scale
quantization coefficient for intra blocks
droppable P-frame used in the scalability mode
#define FFSWAP(type, a, b)
uint32_t buf_offs
address in the output buffer for this mb
information for Indeo wavelet band
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.