Go to the documentation of this file.
30 #define BITSTREAM_READER_LE
49 #define IVI5_PIC_SIZE_ESC 15
62 int result,
i, p, tile_size, pic_size_indx, mb_size, blk_size, is_scalable;
63 int quant_mat, blk_size_changed = 0;
74 tile_size = (
ctx->gop_flags & 0x40) ? 64 <<
get_bits(&
ctx->gb, 2) : 0;
75 if (tile_size > 256) {
86 av_log(avctx,
AV_LOG_ERROR,
"Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",
100 if (
ctx->gop_flags & 2) {
122 ctx->pic_conf = pic_conf;
123 ctx->is_scalable = is_scalable;
124 blk_size_changed = 1;
127 for (p = 0; p <= 1; p++) {
129 band = &
ctx->planes[p].bands[
i];
135 mb_size = blk_size << !mb_size;
137 if (p==0 && blk_size==4) {
142 blk_size_changed = mb_size != band->
mb_size || blk_size != band->
blk_size;
143 if (blk_size_changed) {
154 switch ((p << 2) +
i) {
231 band1 = &
ctx->planes[1].bands[
i];
232 band2 = &
ctx->planes[2].bands[
i];
251 if (blk_size_changed) {
256 "Couldn't reallocate internal structures!\n");
261 if (
ctx->gop_flags & 8) {
279 }
while (
i & 0x8000);
324 ctx->prev_frame_type =
ctx->frame_type;
326 if (
ctx->frame_type >= 5) {
337 ctx->gop_invalid = 1;
340 ctx->gop_invalid = 0;
357 if (
ctx->frame_flags & 0x20)
391 if (band_flags & 1) {
405 if (band_flags & 0x10) {
434 if (band_flags & 0x20) {
458 int x, y, mv_x, mv_y, mv_delta, offs, mb_offset,
487 mb->buf_offs = mb_offset;
504 mb->mv_x =
mb->mv_y = 0;
530 if (ref_mb)
mb->q_delta = ref_mb->
q_delta;
532 (
ctx->frame_flags & 8))) {
540 mb->mv_x =
mb->mv_y = 0;
567 if ( x + (
mb->mv_x >>
s) + (y+ (
mb->mv_y >>
s))*band->
pitch < 0 ||
596 switch (
ctx->prev_frame_type) {
599 ctx->buf_switch ^= 1;
600 ctx->dst_buf =
ctx->buf_switch;
601 ctx->ref_buf =
ctx->buf_switch ^ 1;
604 if (!
ctx->inter_scal) {
609 ctx->ref_buf =
ctx->ref2_buf;
615 switch (
ctx->frame_type) {
621 ctx->dst_buf =
ctx->buf_switch;
622 ctx->ref_buf =
ctx->buf_switch ^ 1;
646 ctx->gop_invalid = 1;
656 ctx->pic_conf.pic_width = avctx->
width;
657 ctx->pic_conf.pic_height = avctx->
height;
658 ctx->pic_conf.chroma_width = (avctx->
width + 3) >> 2;
659 ctx->pic_conf.chroma_height = (avctx->
height + 3) >> 2;
660 ctx->pic_conf.tile_width = avctx->
width;
661 ctx->pic_conf.tile_height = avctx->
height;
662 ctx->pic_conf.luma_bands =
ctx->pic_conf.chroma_bands = 1;
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int get_bits_left(GetBitContext *gb)
const uint8_t * inter_scale
quantization coefficient for inter blocks
av_cold void ff_ivi_init_static_vlc(void)
Initialize static codes used for macroblock and block decoding.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
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.
InvTransformPtr * inv_transform
const FFCodec ff_indeo5_decoder
int rvmap_sel
rvmap table selector
DCTransformPtr * dc_transform
static int ivi_scale_mv(int mv, int mv_scale)
scale motion vector
uint8_t type
macroblock type: 0 - INTRA, 1 - INTER
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.
int num_MBs
number of macroblocks in this tile
#define IVI_TOSIGNED(val)
convert unsigned values into signed ones (the sign is in the LSB)
static void skip_bits(GetBitContext *s, int n)
static int ivi_pic_config_cmp(IVIPicConfig *str1, IVIPicConfig *str2)
compare some properties of two pictures
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
AVCodec p
The public AVCodec.
int num_corr
number of correction entries
information for Indeo wavelet band
av_cold int ff_ivi_decode_close(AVCodecContext *avctx)
Close Indeo5 decoder and clean up its context.
static const uint8_t ivi5_scale_quant_4x4_intra[24]
#define IVI5_IS_PROTECTED
static av_cold int decode_init(AVCodecContext *avctx)
Initialize Indeo5 decoder.
const uint16_t * intra_base
quantization matrix for intra blocks
#define IVI_MBs_PER_TILE(tile_width, tile_height, mb_size)
calculate number of macroblocks in a tile
void ff_ivi_col_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D column slant transform
information for Indeo macroblock (16x16, 8x8 or 4x4)
static const uint8_t ivi5_scale_quant_4x4_inter[24]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define IVI_VLC_BITS
max number of bits of the ivi's huffman codes
#define FF_CODEC_DECODE_CB(func)
@ FRAMETYPE_NULL
empty frame with no data
static void switch_buffers(IVI45DecContext *ctx)
Switch buffers.
int8_t mv_x
motion vector (x component)
void ff_ivi_row_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D row slant transform
static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
Decode Indeo5 GOP (Group of pictures) header.
const uint8_t * scan
ptr to the scan pattern
const uint16_t * inter_base
quantization matrix for inter blocks
#define CODEC_LONG_NAME(str)
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.
and forward the result(frame or status change) to the corresponding input. If nothing is possible
static int skip_hdr_extension(GetBitContext *gb)
Skip a header extension.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int data_size
size of the band data
av_cold int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height)
Initialize tile and macroblock descriptors.
static unsigned int get_bits1(GetBitContext *s)
int inherit_mv
tells if motion vector is inherited from reference macroblock
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
#define IVI5_PIC_SIZE_ESC
static const uint16_t ivi5_base_quant_4x4_inter[16]
const uint8_t ff_ivi_vertical_scan_8x8[64]
Scan patterns shared between indeo4 and indeo5.
const uint8_t ff_ivi_horizontal_scan_8x8[64]
int(* init)(AVBSFContext *ctx)
const RVMapDesc ff_ivi_rvmap_tabs[9]
Run-value (RLE) tables.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
int32_t checksum
for debug purposes
static const uint8_t ivi5_scale_quant_8x8_inter[5][24]
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
av_cold int ff_ivi_init_planes(AVCodecContext *avctx, IVIPlaneDesc *planes, const IVIPicConfig *cfg, int is_indeo4)
Initialize planes (prepares descriptors, allocates buffers etc).
@ IVI_BLK_HUFF
Huffman table is used for coding blocks.
int plane
plane number this band belongs to
static const uint8_t ivi5_common_pic_sizes[30]
standard picture dimensions (width, height divided by 4)
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
int mb_size
macroblock size
static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
Decode Indeo5 picture header.
information for Indeo tile
static av_always_inline void mv_scale(Mv *dst, const Mv *src, int td, int tb)
const uint8_t * intra_scale
quantization coefficient for intra blocks
IVIMbInfo * mbs
array of macroblock descriptors
@ IVI_MB_HUFF
Huffman table is used for coding macroblocks.
#define i(width, name, range_min, range_max)
int bufsize
band buffer size in bytes
IVIMbInfo * ref_mbs
ptr to the macroblock descriptors of the reference tile
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
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.
int8_t q_delta
quant delta
static const uint16_t ivi5_base_quant_8x8_intra[5][64]
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.
const uint8_t ff_zigzag_direct[64]
#define FFSWAP(type, a, b)
int qdelta_present
tells if Qdelta signal is present in the bitstream (Indeo5 only)
const uint8_t ff_ivi_direct_scan_4x4[16]
static const uint8_t * align_get_bits(GetBitContext *s)
int is_2d_trans
1 indicates that the two-dimensional inverse transform is used
int ff_ivi_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
int is_empty
= 1 if this band doesn't contain any data
main external API structure.
static const uint16_t ivi5_base_quant_4x4_intra[16]
@ FRAMETYPE_INTER_SCAL
droppable P-frame used in the scalability mode
static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band, AVCodecContext *avctx)
Decode Indeo5 band header.
IVIHuffTab blk_vlc
vlc table for decoding block data
@ FRAMETYPE_INTER
non-droppable P-frame
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.
int inherit_qdelta
tells if quantiser delta is inherited from reference macroblock
uint8_t corr[61 *2]
rvmap correction pairs
int width
picture width / height.
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static const uint16_t ivi5_base_quant_8x8_inter[5][64]
Indeo5 dequantization matrixes consist of two tables: base table and scale table.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int is_halfpel
precision of the motion compensation: 0 - fullpel, 1 - halfpel
int glob_quant
quant base for this band
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.
static const uint8_t ivi5_scale_quant_8x8_intra[5][24]
ptrdiff_t pitch
pitch associated with the buffers above
@ FRAMETYPE_INTER_NOREF
droppable P-frame
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
int8_t mv_y
motion vector (y component)